diff --git a/app/queries/events_query.rb b/app/queries/events_query.rb index 91f0a4ea7..4c111d248 100644 --- a/app/queries/events_query.rb +++ b/app/queries/events_query.rb @@ -22,7 +22,7 @@ def initialize() def doi_citations(doi) pid = Event.new.normalize_doi(doi) query = "(subj_id:\"#{pid}\" AND (relation_type_id:#{PASSIVE_RELATION_TYPES.join(' OR relation_type_id:')})) OR (obj_id:\"#{pid}\" AND (relation_type_id:#{ACTIVE_RELATION_TYPES.join(' OR relation_type_id:')}))" - results = Event.query(query, doi:doi, aggregations: "citation_count_aggregation", unqiue: true).response.aggregations.citations.buckets + results = Event.query(query, doi:doi, aggregations: "citation_count_aggregation", page: { size: 1, cursor: [] }).response.aggregations.citations.buckets results.any? ? results.first.total.value : 0 end