Class: Sunspot::Query::Local
- Inherits:
-
Object
- Object
- Sunspot::Query::Local
- Defined in:
- lib/sunspot/query/local.rb
Overview
This query component generates parameters for LocalSolr geo-radial searches. The LocalSolr API is fairly rigid, so the Local component doesn’t have any options - it just takes coordinates and a radius, and generates the appropriate parameters.
Instance Method Summary collapse
-
#initialize(coordinates, radius) ⇒ Local
constructor
:nodoc:.
- #to_params ⇒ Object
Constructor Details
#initialize(coordinates, radius) ⇒ Local
:nodoc:
10 11 12 |
# File 'lib/sunspot/query/local.rb', line 10 def initialize(coordinates, radius) @coordinates, @radius = Util::Coordinates.new(coordinates), radius end |
Instance Method Details
#to_params ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/sunspot/query/local.rb', line 14 def to_params { :qt => 'geo', :lat => @coordinates.lat, :long => @coordinates.lng, :radius => @radius } end |