Class: Sunspot::Query::Sort::GeodistSort
- Defined in:
- lib/sunspot/query/sort.rb
Overview
A GeodistSort sorts by distance from a given point.
Instance Method Summary collapse
-
#initialize(field, lat, lon, direction) ⇒ GeodistSort
constructor
A new instance of GeodistSort.
- #to_param ⇒ Object
Constructor Details
#initialize(field, lat, lon, direction) ⇒ GeodistSort
Returns a new instance of GeodistSort.
102 103 104 105 |
# File 'lib/sunspot/query/sort.rb', line 102 def initialize(field, lat, lon, direction) @lat, @lon = lat, lon super(field, direction) end |
Instance Method Details
#to_param ⇒ Object
107 108 109 |
# File 'lib/sunspot/query/sort.rb', line 107 def to_param "geodist(#{@field.indexed_name.to_sym},#{@lat},#{@lon}) #{direction_for_solr}" end |