diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index 90a709711..53e4433ee 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -173,6 +173,23 @@ def query(query, options={}) elsif self.name == "Doi" must << { terms: { aasm_state: options[:state].to_s.split(",") }} if options[:state].present? must << { range: { registered: { gte: "#{options[:registered].split(",").min}||/y", lte: "#{options[:registered].split(",").max}||/y", format: "yyyy" }}} if options[:registered].present? + elsif self.name == "Event" + must << { term: { subj_id: options[:subj_id] }} if options[:subj_id].present? + must << { term: { obj_id: options[:obj_id] }} if options[:obj_id].present? + must << { term: { citation_type: options[:citation_type] }} if options[:citation_type].present? + must << { term: { year_month: options[:year_month] }} if options[:year_month].present? + must << { range: { "subj.datePublished" => { gte: "#{options[:publication_year].split("-").min}||/y", lte: "#{options[:publication_year].split("-").max}||/y", format: "yyyy" }}} if options[:publication_year].present? + must << { range: { occurred_at: { gte: "#{options[:occurred_at].split("-").min}||/y", lte: "#{options[:occurred_at].split("-").max}||/y", format: "yyyy" }}} if options[:occurred_at].present? + must << { terms: { prefix: options[:prefix].split(",") }} if options[:prefix].present? + must << { terms: { doi: options[:doi].downcase.split(",") }} if options[:doi].present? + must << { terms: { orcid: options[:orcid].split(",") }} if options[:orcid].present? + must << { terms: { isni: options[:isni].split(",") }} if options[:isni].present? + must << { terms: { subtype: options[:subtype].split(",") }} if options[:subtype].present? + must << { terms: { source_id: options[:source_id].split(",") }} if options[:source_id].present? + must << { terms: { relation_type_id: options[:relation_type_id].split(",") }} if options[:relation_type_id].present? + must << { terms: { registrant_id: options[:registrant_id].split(",") }} if options[:registrant_id].present? + must << { terms: { registrant_id: options[:provider_id].split(",") }} if options[:provider_id].present? + must << { terms: { issn: options[:issn].split(",") }} if options[:issn].present? end # ES query can be optionally defined in different ways