Sha256: 3571db93fed51840266081c6930e901a9afc5b9ebd680e8ecac47d7027fee9ea

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

module Sunspot
  module Query
    # 
    # 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.
    #
    class Local #:nodoc:
      def initialize(coordinates, radius)
        @coordinates, @radius = Util::Coordinates.new(coordinates), radius
      end

      def to_params
        {
          :qt => 'geo',
          :lat => @coordinates.lat,
          :long => @coordinates.lng,
          :radius => @radius
        }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
benjaminkrause-sunspot-0.9.7 lib/sunspot/query/local.rb
benjaminkrause-sunspot-0.9.8 lib/sunspot/query/local.rb
kuahyeow-sunspot-0.10.3 lib/sunspot/query/local.rb
sunspot-0.10.2 lib/sunspot/query/local.rb
sunspot-0.10.1 lib/sunspot/query/local.rb
sunspot-0.10.0 lib/sunspot/query/local.rb