Class: Solr::Query::Request::Boosting::RecentFieldValueBoostFunction
- Inherits:
-
Object
- Object
- Solr::Query::Request::Boosting::RecentFieldValueBoostFunction
- Includes:
- Support::SchemaHelper
- Defined in:
- lib/solr/query/request/boosting/recent_field_value_boost_function.rb
Instance Attribute Summary collapse
-
#boost_magnitude ⇒ Object
readonly
Returns the value of attribute boost_magnitude.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#max_age_days ⇒ Object
readonly
Returns the value of attribute max_age_days.
Instance Method Summary collapse
-
#initialize(field:, boost_magnitude:, max_age_days:) ⇒ RecentFieldValueBoostFunction
constructor
A new instance of RecentFieldValueBoostFunction.
- #to_solr_s ⇒ Object
Methods included from Support::SchemaHelper
Constructor Details
#initialize(field:, boost_magnitude:, max_age_days:) ⇒ RecentFieldValueBoostFunction
Returns a new instance of RecentFieldValueBoostFunction.
10 11 12 13 14 15 |
# 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 |
Instance Attribute Details
#boost_magnitude ⇒ Object (readonly)
Returns the value of attribute boost_magnitude.
8 9 10 |
# File 'lib/solr/query/request/boosting/recent_field_value_boost_function.rb', line 8 def boost_magnitude @boost_magnitude end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
8 9 10 |
# File 'lib/solr/query/request/boosting/recent_field_value_boost_function.rb', line 8 def field @field end |
#max_age_days ⇒ Object (readonly)
Returns the value of attribute max_age_days.
8 9 10 |
# File 'lib/solr/query/request/boosting/recent_field_value_boost_function.rb', line 8 def max_age_days @max_age_days end |
Instance Method Details
#to_solr_s ⇒ Object
17 18 19 20 21 |
# 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 |