class Daedal::Queries::RangeQuery
Constants
- MINIMUM_ATTRIBUTES
non required attributes, but at least one must be given
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
# File lib/daedal/queries/range_query.rb, line 16 def initialize(options={}) super options # ensure at least one of the minimum attributes is provided raise "Must give at least one of the following: #{MINIMUM_ATTRIBUTES.join(', ')}" unless (attributes.reject { |k,v| v.nil? }.keys & MINIMUM_ATTRIBUTES).length > 0 end
Public Instance Methods
to_hash()
click to toggle source
# File lib/daedal/queries/range_query.rb, line 24 def to_hash inner_result = attributes.select { |k,v| MINIMUM_ATTRIBUTES.include?(k) && !v.nil? } inner_result.merge!(boost: boost) if boost {range: {field => inner_result} } end