Class: Solr::Query::Request::Boosting::LnFunctionBoost

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::SchemaHelper

#solarize_field

Constructor Details

#initialize(field:, min: 0.69, boost_magnitude: 1) ⇒ LnFunctionBoost

Returns a new instance of LnFunctionBoost.



10
11
12
13
14
15
# File 'lib/solr/query/request/boosting/ln_function_boost.rb', line 10

def initialize(field:, min: 0.69, boost_magnitude: 1)
  @field = field
  @min = min
  @boost_magnitude = boost_magnitude
  freeze
end

Instance Attribute Details

#boost_magnitudeObject (readonly)

Returns the value of attribute boost_magnitude.



8
9
10
# File 'lib/solr/query/request/boosting/ln_function_boost.rb', line 8

def boost_magnitude
  @boost_magnitude
end

#fieldObject (readonly)

Returns the value of attribute field.



8
9
10
# File 'lib/solr/query/request/boosting/ln_function_boost.rb', line 8

def field
  @field
end

#minObject (readonly)

Returns the value of attribute min.



8
9
10
# File 'lib/solr/query/request/boosting/ln_function_boost.rb', line 8

def min
  @min
end

Instance Method Details

#solr_fieldObject



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

def solr_field
  solarize_field(field)
end

#to_solr_sObject



17
18
19
# File 'lib/solr/query/request/boosting/ln_function_boost.rb', line 17

def to_solr_s
  "mul(if(gt(#{solr_field},1),ln(#{solr_field}),#{min}),#{boost_magnitude})"
end