Class: Sunspot::Query::Bbox

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

Instance Method Summary collapse

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_paramsObject



8
9
10
11
12
# File 'lib/sunspot/query/bbox.rb', line 8

def to_params
  filter = "#{@field.indexed_name}:[#{@first_corner.join(",")} TO #{@second_corner.join(",")}]"

  {:fq => filter}
end