From 792b23ed3a95f6ef512114ff9a5a5f491bcb2e91 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Mon, 17 Feb 2020 11:03:47 +0100 Subject: [PATCH] support ranges in has_citations queries --- app/models/doi.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/doi.rb b/app/models/doi.rb index 767d644a7..27561905a 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -693,9 +693,9 @@ def self.query(query, options={}) must << { term: { schema_version: "http://datacite.org/schema/kernel-#{options[:schema_version]}" }} if options[:schema_version].present? must << { terms: { "subjects.subject": options[:subject].split(",") } } if options[:subject].present? must << { term: { source: options[:source] } } if options[:source].present? - must << { range: { citation_count: { "gte": 1 } } } if options[:has_citations].present? - must << { range: { view_count: { "gte": 1 } } } if options[:has_views].present? - must << { range: { download_count: { "gte": 1 } } } if options[:has_downloads].present? + must << { range: { citation_count: { "gte": options[:has_citations].to_i } } } if options[:has_citations].present? + must << { range: { view_count: { "gte": options[:has_views].to_i } } } if options[:has_views].present? + must << { range: { download_count: { "gte": options[:has_downloads].to_i } } } if options[:has_downloads].present? must << { term: { "landing_page.status": options[:link_check_status] } } if options[:link_check_status].present? must << { exists: { field: "landing_page.checked" }} if options[:link_checked].present? must << { term: { "landing_page.hasSchemaOrg": options[:link_check_has_schema_org] }} if options[:link_check_has_schema_org].present?