From 22c6d3c1f4594f61d68c0356179cbbe9b39bf76b Mon Sep 17 00:00:00 2001 From: kjgarza Date: Wed, 22 Jan 2020 23:48:44 +0100 Subject: [PATCH] enable aggregations for prefixes, providers, repos addresses https://github.com/datacite/datacite/issues/935 --- app/models/doi.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/doi.rb b/app/models/doi.rb index ae50b9e66..7869d556e 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -583,6 +583,16 @@ def self.query(query, options={}) options[:page][:number] ||= 1 options[:page][:size] ||= 25 + if options[:totals_agg] == "provider" + aggregations = provider_aggregations + elsif options[:totals_agg] == "client" + aggregations = client_aggregations + elsif options[:totals_agg] == "prefix" + aggregations = prefix_aggregations + else + aggregations = get_aggregations_hash(options) + end + # Cursor nav use the search after, this should always be an array of values that match the sort. if options.dig(:page, :cursor) from = 0