Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ change as part of the work.

- `ABOUT_APP`: If populated, an 'about' partial containing the contents of this variable will render on
`basic_search#index`.
- `ACTIVE_FILTERS`: If populated, this list of strings defines which filters are shown to the user, and the order in which they appear. Values are case sensitive, and must match those used in the TIMDEX GraphQL query. Extraneous values will be ignored. If not populated, all filters will be shown.
- `ACTIVE_FILTERS`: If populated, this list of strings defines which filters are shown to the user, and the order in which they appear. Values are case sensitive, and must match the corresponding aggregations used in the TIMDEX GraphQL query. Extraneous values will be ignored. If not populated, all filters will be shown.
- `FILTER_ACCESS_TO_FILES`: The name to use instead of "Access to files" for that filter / aggregation.
- `FILTER_CONTENT_TYPE`: The name to use instead of "Content type" for that filter / aggregation.
- `FILTER_CONTRIBUTOR`: The name to use instead of "Contributor" for that filter / aggregation.
- `FILTER_FORMAT`: The name to use instead of "Format" for that filter / aggregation.
Expand Down
1 change: 1 addition & 0 deletions app/helpers/filter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def add_filter(query, filter, term)

def nice_labels
{
accessToFilesFilter: ENV.fetch('FILTER_ACCESS_TO_FILES', 'Access to files'),
contentTypeFilter: ENV.fetch('FILTER_CONTENT_TYPE', 'Content type'),
contributorsFilter: ENV.fetch('FILTER_CONTRIBUTOR', 'Contributor'),
formatFilter: ENV.fetch('FILTER_FORMAT', 'Format'),
Expand Down
4 changes: 2 additions & 2 deletions app/models/enhancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class Enhancer
attr_accessor :enhanced_query

QUERY_PARAMS = %i[q citation contentType contributors fundingInformation identifiers locations subjects title].freeze
FILTER_PARAMS = %i[contentTypeFilter contributorsFilter formatFilter languagesFilter literaryFormFilter placesFilter
sourceFilter subjectsFilter].freeze
FILTER_PARAMS = %i[accessToFilesFilter contentTypeFilter contributorsFilter formatFilter languagesFilter
literaryFormFilter placesFilter sourceFilter subjectsFilter].freeze
GEO_PARAMS = %i[geoboxMinLongitude geoboxMinLatitude geoboxMaxLongitude geoboxMaxLatitude geodistanceLatitude
geodistanceLongitude geodistanceDistance].freeze

Expand Down
4 changes: 2 additions & 2 deletions app/models/query_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class QueryBuilder

RESULTS_PER_PAGE = 20
QUERY_PARAMS = %w[q citation contributors fundingInformation identifiers locations subjects title].freeze
FILTER_PARAMS = %i[contentTypeFilter contributorsFilter formatFilter languagesFilter literaryFormFilter placesFilter
sourceFilter subjectsFilter].freeze
FILTER_PARAMS = %i[accessToFilesFilter contentTypeFilter contributorsFilter formatFilter languagesFilter
literaryFormFilter placesFilter sourceFilter subjectsFilter].freeze
GEO_PARAMS = %w[geoboxMinLongitude geoboxMinLatitude geoboxMaxLongitude geoboxMaxLatitude geodistanceLatitude
geodistanceLongitude geodistanceDistance].freeze

Expand Down
24 changes: 24 additions & 0 deletions app/models/timdex_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class TimdexSearch < TimdexBase
$title: String
$index: String
$from: String
$accessToFilesFilter: [String!]
$contentTypeFilter: [String!]
$contributorsFilter: [String!]
$formatFilter: [String!]
Expand All @@ -34,6 +35,7 @@ class TimdexSearch < TimdexBase
title: $title
index: $index
from: $from
accessToFilesFilter: $accessToFilesFilter
contentTypeFilter: $contentTypeFilter
contributorsFilter: $contributorsFilter
formatFilter: $formatFilter
Expand Down Expand Up @@ -81,6 +83,10 @@ class TimdexSearch < TimdexBase
summary
}
aggregations {
accessToFiles {
key
docCount
}
contentType {
key
docCount
Expand Down Expand Up @@ -134,6 +140,7 @@ class TimdexSearch < TimdexBase
$geoboxMinLongitude: Float!
$geoboxMaxLatitude: Float!
$geoboxMaxLongitude: Float!
$accessToFilesFilter: [String!]
$contentTypeFilter: [String!]
$contributorsFilter: [String!]
$formatFilter: [String!]
Expand All @@ -159,6 +166,7 @@ class TimdexSearch < TimdexBase
maxLongitude: $geoboxMaxLongitude,
maxLatitude: $geoboxMaxLatitude
}
accessToFilesFilter: $accessToFilesFilter
contentTypeFilter: $contentTypeFilter
contributorsFilter: $contributorsFilter
formatFilter: $formatFilter
Expand Down Expand Up @@ -205,6 +213,10 @@ class TimdexSearch < TimdexBase
summary
}
aggregations {
accessToFiles {
key
docCount
}
contentType {
key
docCount
Expand Down Expand Up @@ -250,6 +262,7 @@ class TimdexSearch < TimdexBase
$title: String
$index: String
$from: String
$accessToFilesFilter: [String!]
$geodistanceDistance: String!
$geodistanceLatitude: Float!
$geodistanceLongitude: Float!
Expand Down Expand Up @@ -277,6 +290,7 @@ class TimdexSearch < TimdexBase
latitude: $geodistanceLatitude,
longitude: $geodistanceLongitude
}
accessToFilesFilter: $accessToFilesFilter
contentTypeFilter: $contentTypeFilter
contributorsFilter: $contributorsFilter
formatFilter: $formatFilter
Expand Down Expand Up @@ -323,6 +337,10 @@ class TimdexSearch < TimdexBase
summary
}
aggregations {
accessToFiles {
key
docCount
}
contentType {
key
docCount
Expand Down Expand Up @@ -368,6 +386,7 @@ class TimdexSearch < TimdexBase
$title: String
$index: String
$from: String
$accessToFilesFilter: [String!]
$geodistanceDistance: String!
$geodistanceLatitude: Float!
$geodistanceLongitude: Float!
Expand Down Expand Up @@ -405,6 +424,7 @@ class TimdexSearch < TimdexBase
maxLongitude: $geoboxMaxLongitude,
maxLatitude: $geoboxMaxLatitude
}
accessToFilesFilter: $accessToFilesFilter
contentTypeFilter: $contentTypeFilter
contributorsFilter: $contributorsFilter
formatFilter: $formatFilter
Expand Down Expand Up @@ -451,6 +471,10 @@ class TimdexSearch < TimdexBase
summary
}
aggregations {
accessToFiles {
key
docCount
}
contentType {
key
docCount
Expand Down
49 changes: 25 additions & 24 deletions test/vcr_cassettes/advanced.yml

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions test/vcr_cassettes/advanced_all_spaces.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 25 additions & 24 deletions test/vcr_cassettes/advanced_citation_asdf.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading