Skip to content

Commit

Permalink
filter uniques on lists
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Nov 28, 2019
1 parent 18369e2 commit b5ac7eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ doc/dependencies*
docker-compose.override.yml
.ruby-version
.vscode
.solargraph
.solargraph.yml
2 changes: 1 addition & 1 deletion app/queries/events_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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", page: { size: 1, cursor: [] }).response.aggregations.citations.buckets
results = Event.query(query, doi:doi, aggregations: "citation_count_aggregation", unqiue: true).response.aggregations.citations.buckets
results.any? ? results.first.total.value : 0
end

Expand Down

0 comments on commit b5ac7eb

Please sign in to comment.