Class: Solr::Query::Request::Boosting::GeodistFunction

Inherits:
Object
  • Object
show all
Includes:
Support::SchemaHelper
Defined in:
lib/solr/query/request/boosting/geodist_function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::SchemaHelper

#solarize_field

Constructor Details

#initialize(field:, latitude:, longitude:) ⇒ GeodistFunction

Returns a new instance of GeodistFunction.



13
14
15
16
17
18
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 13

def initialize(field:, latitude:, longitude:)
  @field = field
  @latitude = latitude
  @longitude = longitude
  freeze
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



11
12
13
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 11

def field
  @field
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



11
12
13
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 11

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



11
12
13
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 11

def longitude
  @longitude
end

Instance Method Details

#latlngObject

TODO: Check this dead code and the initialize arguments



26
27
28
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 26

def latlng
  "#{latitude},#{longitude}"
end

#sfieldObject



30
31
32
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 30

def sfield
  solarize_field(field)
end

#to_solr_sObject



20
21
22
23
# File 'lib/solr/query/request/boosting/geodist_function.rb', line 20

def to_solr_s
  # this constants are magical, but they influence the slope of geo proximity decay function
  'recip(geodist(),3,17000,3000)'
end