Class: Sunspot::Query::Geofilt
- Inherits:
-
Object
- Object
- Sunspot::Query::Geofilt
- Defined in:
- lib/sunspot/query/geofilt.rb
Instance Method Summary collapse
-
#initialize(field, lat, lon, radius, options = {}) ⇒ Geofilt
constructor
A new instance of Geofilt.
- #to_params ⇒ Object
Constructor Details
#initialize(field, lat, lon, radius, options = {}) ⇒ Geofilt
Returns a new instance of Geofilt.
4 5 6 |
# File 'lib/sunspot/query/geofilt.rb', line 4 def initialize(field, lat, lon, radius, = {}) @field, @lat, @lon, @radius, @options = field, lat, lon, radius, end |
Instance Method Details
#to_params ⇒ Object
8 9 10 11 12 13 |
# File 'lib/sunspot/query/geofilt.rb', line 8 def to_params func = @options[:bbox] ? "bbox" : "geofilt" filter = "{!#{func} sfield=#{@field.indexed_name} pt=#{@lat},#{@lon} d=#{@radius}}" {:fq => filter} end |