diff --git a/app/graphql/types/aggregations_type.rb b/app/graphql/types/aggregations_type.rb index 9e34c41f..c2ad14c7 100644 --- a/app/graphql/types/aggregations_type.rb +++ b/app/graphql/types/aggregations_type.rb @@ -12,6 +12,7 @@ class AggregationsType < Types::BaseObject field :languages, [Types::AggregationCountType], null: true, description: 'Total search results by language' field :literary_form, [Types::AggregationCountType], null: true, description: 'Total search results by fiction or nonfiction' + field :publication_information, [Types::AggregationCountType], null: true, description: 'Total search results by publisher' field :source, [Types::AggregationCountType], null: true, description: 'Total search results by source record system' field :subjects, [Types::AggregationCountType], null: true, description: 'Total search results by subject term' diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index beb7146b..33205101 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -71,6 +71,8 @@ def record_id(id:, index:) 'aggregation for a list of possible values' argument :literary_form_filter, String, required: false, default_value: nil, description: 'Filter results by fiction or nonfiction' + argument :publication_information_filter, [String], required: false, default_value: nil, + description: 'Filter results by publication information' argument :source_filter, [String], required: false, default_value: nil, description: 'Filter by source record system. Use the `sources` aggregation ' \ 'for a list of possible values' @@ -129,6 +131,7 @@ def construct_query(searchterm, citation, contributors, funding_information, geo query[:contributors_filter] = filters[:contributors_filter] query[:languages_filter] = filters[:languages_filter] query[:literary_form_filter] = filters[:literary_form_filter] + query[:publication_information_filter] = filters[:publication_information_filter] query = source_deprecation_handler(query, filters[:source_filter], source) query[:subjects_filter] = filters[:subjects_filter] query @@ -149,6 +152,7 @@ def collapse_buckets(es_aggs) subjects: es_aggs['subjects']['subject_names']['buckets'], languages: es_aggs['languages']['buckets'], literary_form: es_aggs['literary_form']['buckets'], + publication_information: es_aggs['publication_information']['buckets'], format: es_aggs['content_format']['buckets'], content_type: es_aggs['content_type']['buckets'] } diff --git a/app/models/opensearch.rb b/app/models/opensearch.rb index 47a3a4e8..70105873 100644 --- a/app/models/opensearch.rb +++ b/app/models/opensearch.rb @@ -280,6 +280,11 @@ def aggregations field: 'literary_form' } }, + publication_information: { + terms: { + field: 'publication_information' + } + }, source: { terms: { field: 'source'