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