class PdfSearch::ElasticSearchQuery
Attributes
client_query_specification[R]
search_index[R]
Public Class Methods
new(client_query_specification, search_index)
click to toggle source
# File lib/elastic_search_query.rb, line 8 def initialize(client_query_specification, search_index) @search_index = search_index @client_query_specification = client_query_specification end
Public Instance Methods
range_queries()
click to toggle source
# File lib/elastic_search_query.rb, line 29 def range_queries return [] if search_index.search_input_fields_by_type.nil? search_index.search_input_fields_by_type[:interval].map do |name| { "range": { name => { gte: client_query_specification["search_#{name}_start"], lte: client_query_specification["search_#{name}_end"] } } } end end
to_hash()
click to toggle source
# File lib/elastic_search_query.rb, line 13 def to_hash { "query": { "bool": { "must": [ { "match": { "text": client_query_specification['search'] } } ].concat(range_queries) } } } end