Class: Sunspot::Query::Geo
- Inherits:
-
Object
- Object
- Sunspot::Query::Geo
- Defined in:
- lib/sunspot/query/geo.rb
Constant Summary collapse
- MAX_PRECISION =
12
- DEFAULT_PRECISION =
7
- DEFAULT_PRECISION_FACTOR =
16.0
Instance Method Summary collapse
-
#initialize(field, lat, lng, options) ⇒ Geo
constructor
A new instance of Geo.
- #to_params ⇒ Object
- #to_subquery ⇒ Object
Constructor Details
#initialize(field, lat, lng, options) ⇒ Geo
Returns a new instance of Geo.
14 15 16 17 |
# File 'lib/sunspot/query/geo.rb', line 14 def initialize(field, lat, lng, ) @field, @options = field, @geohash = GeoHash.encode(lat.to_f, lng.to_f, MAX_PRECISION) end |
Instance Method Details
#to_params ⇒ Object
19 20 21 |
# File 'lib/sunspot/query/geo.rb', line 19 def to_params { :q => to_boolean_query } end |
#to_subquery ⇒ Object
23 24 25 |
# File 'lib/sunspot/query/geo.rb', line 23 def to_subquery "(#{to_boolean_query})" end |