Class: Sunspot::Type::LatlonType

Inherits:
AbstractType show all
Defined in:
lib/sunspot/type.rb

Overview

The Latlon type encodes geographical coordinates in the native Solr LatLonType.

The data for this type must respond to the ‘lat` and `lng` methods; you can use Sunspot::Util::Coordinates as a wrapper if your source data does not follow this API.

Location fields can be used with the geospatial DSL. See the Geospatial section of the README for examples.

Instance Method Summary collapse

Methods inherited from AbstractType

#accepts_dynamic?, #accepts_more_like_this?, #to_literal

Instance Method Details

#indexed_name(name) ⇒ Object



369
370
371
# File 'lib/sunspot/type.rb', line 369

def indexed_name(name)
  "#{name}_ll"
end

#to_indexed(value) ⇒ Object



373
374
375
# File 'lib/sunspot/type.rb', line 373

def to_indexed(value)
  "#{value.lat.to_f},#{value.lng.to_f}"
end