Class: Sunspot::Query::Geofilt

Inherits:
Object
  • Object
show all
Defined in:
lib/sunspot/query/geofilt.rb

Instance Method Summary collapse

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, options = {})
  @field, @lat, @lon, @radius, @options = field, lat, lon, radius, options
end

Instance Method Details

#to_paramsObject



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