Class: Sunspot::Query::Bbox
- Inherits:
-
Object
- Object
- Sunspot::Query::Bbox
- Defined in:
- lib/sunspot/query/bbox.rb
Instance Method Summary collapse
-
#initialize(field, first_corner, second_corner) ⇒ Bbox
constructor
A new instance of Bbox.
- #to_params ⇒ Object
- #to_solr_conditional ⇒ Object
Constructor Details
#initialize(field, first_corner, second_corner) ⇒ Bbox
Returns a new instance of Bbox.
4 5 6 |
# File 'lib/sunspot/query/bbox.rb', line 4 def initialize(field, first_corner, second_corner) @field, @first_corner, @second_corner = field, first_corner, second_corner end |
Instance Method Details
#to_params ⇒ Object
12 13 14 15 16 |
# File 'lib/sunspot/query/bbox.rb', line 12 def to_params filter = "#{@field.indexed_name}:#{to_solr_conditional}" {:fq => filter} end |
#to_solr_conditional ⇒ Object
8 9 10 |
# File 'lib/sunspot/query/bbox.rb', line 8 def to_solr_conditional "[#{@first_corner.join(",")} TO #{@second_corner.join(",")}]" end |