Class: Sunspot::Query::Geofilt
- Inherits:
-
Object
- Object
- Sunspot::Query::Geofilt
- Includes:
- Filter
- Defined in:
- lib/sunspot/query/geofilt.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
-
#initialize(field, lat, lon, radius, options = {}) ⇒ Geofilt
constructor
A new instance of Geofilt.
- #to_boolean_phrase ⇒ Object
- #to_params ⇒ Object
Methods included from Filter
Constructor Details
#initialize(field, lat, lon, radius, options = {}) ⇒ Geofilt
Returns a new instance of Geofilt.
7 8 9 |
# File 'lib/sunspot/query/geofilt.rb', line 7 def initialize(field, lat, lon, radius, = {}) @field, @lat, @lon, @radius, @options = field, lat, lon, radius, end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
5 6 7 |
# File 'lib/sunspot/query/geofilt.rb', line 5 def field @field end |
Instance Method Details
#to_boolean_phrase ⇒ Object
11 12 13 14 |
# File 'lib/sunspot/query/geofilt.rb', line 11 def to_boolean_phrase func = @options[:bbox] ? "bbox" : "geofilt" "{!#{func} sfield=#{@field.indexed_name} pt=#{@lat},#{@lon} d=#{@radius}}" end |
#to_params ⇒ Object
16 17 18 |
# File 'lib/sunspot/query/geofilt.rb', line 16 def to_params {:fq => to_filter_query} end |