Class: Elasticband::Query::ScoreFunction::BoostMode
- Inherits:
-
Elasticband::Query::ScoreFunction
- Object
- Elasticband::Query::ScoreFunction
- Elasticband::Query::ScoreFunction::BoostMode
- Defined in:
- lib/elasticband/query/score_function/boost_mode.rb
Constant Summary collapse
- MODES =
%i(multiply replace sum avg max min).freeze
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
Instance Method Summary collapse
-
#initialize(mode = nil) ⇒ BoostMode
constructor
A new instance of BoostMode.
- #to_h ⇒ Object
Constructor Details
#initialize(mode = nil) ⇒ BoostMode
Returns a new instance of BoostMode.
9 10 11 |
# File 'lib/elasticband/query/score_function/boost_mode.rb', line 9 def initialize(mode = nil) self.mode = mode end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
5 6 7 |
# File 'lib/elasticband/query/score_function/boost_mode.rb', line 5 def mode @mode end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 |
# File 'lib/elasticband/query/score_function/boost_mode.rb', line 13 def to_h return {} unless mode && MODES.include?(mode) { boost_mode: mode } end |