class Sensei::RangeQuery

Public Instance Methods

to_h() click to toggle source
# File lib/sensei/query.rb, line 141
def to_h
  {:range => {
      options[:field] => {
        :from => options[:from],
        :to => options[:to],
        :_type => options[:type] || ((options[:from].is_a?(Float) || options[:to].is_a?(Float)) ? "double" : "float")
      }.merge(get_boost).merge(options[:type] == :date ? {:_date_format => options[:date_format] || 'YYYY-MM-DD'} : {})
    },
  }
end