class Solr::Query::Request::Boosting::RecentFieldValueBoostFunction

Attributes

boost_magnitude[R]
field[R]
max_age_days[R]

Public Class Methods

new(field:, boost_magnitude:, max_age_days:) click to toggle source
# File lib/solr/query/request/boosting/recent_field_value_boost_function.rb, line 10
def initialize(field:, boost_magnitude:, max_age_days:)
  @field = field
  @boost_magnitude = boost_magnitude
  @max_age_days = max_age_days
  freeze
end

Public Instance Methods

to_solr_s() click to toggle source
# File lib/solr/query/request/boosting/recent_field_value_boost_function.rb, line 17
def to_solr_s
  solr_field = solarize_field(field)
  recip_max_age_days_ms = 1.0 / (max_age_days * 24 * 3600 * 1000)
  "mul(#{boost_magnitude},recip(ms(NOW,#{solr_field}),#{recip_max_age_days_ms},0.5,0.1))"
end