From f06feeb05b9dfb3181bb60076e469684e1fefa90 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 16 Feb 2020 04:00:00 +0100 Subject: [PATCH] support filtering by views, downloads and citations. #390 --- 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 462c70bf6..f02cbfd5d 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -687,9 +687,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 << { term: { citation_count: { "gte": 1 } } } if options[:has_citations].present? - must << { term: { view_count: { "gte": 1 } } } if options[:has_views].present? - must << { term: { download_count: { "gte": 1 } } } if options[:has_downloads].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 << { 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?