Class: Elasticband::Query::ScoreFunction::GeoLocation
- Inherits:
-
Gauss
- Object
- Elasticband::Query::ScoreFunction
- Gauss
- Elasticband::Query::ScoreFunction::GeoLocation
- Defined in:
- lib/elasticband/query/score_function/geo_location.rb
Instance Attribute Summary
Attributes inherited from Gauss
Instance Method Summary collapse
-
#initialize(options) ⇒ GeoLocation
constructor
A new instance of GeoLocation.
Methods inherited from Gauss
Methods inherited from Elasticband::Query::ScoreFunction
Constructor Details
#initialize(options) ⇒ GeoLocation
Returns a new instance of GeoLocation.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/elasticband/query/score_function/geo_location.rb', line 5 def initialize() return unless .present? origin = { lat: [:latitude], lon: [:longitude] } distance = [:distance] location = { origin: origin, offset: distance[:same_score], scale: distance[:half_score] } field = [:on] || :location super(field => location) end |