Class: FunctionScores::WeightedScoreFunctionBuilder
- Inherits:
-
ScoreFunctionBuilder
- Object
- ScoreFunctionBuilder
- FunctionScores::WeightedScoreFunctionBuilder
- Defined in:
- lib/function_scores/weighted_score_function_builder.rb
Overview
A query that multiplies the weight to the score.
Instance Method Summary collapse
-
#function ⇒ Hash
Serialized json query for the object.
-
#initialize ⇒ WeightedScoreFunctionBuilder
constructor
A new instance of WeightedScoreFunctionBuilder.
-
#weight(value) ⇒ Object
Sets the weight value.
Methods inherited from ScoreFunctionBuilder
Methods included from AttributesReader
Constructor Details
#initialize ⇒ WeightedScoreFunctionBuilder
Returns a new instance of WeightedScoreFunctionBuilder.
12 13 14 |
# File 'lib/function_scores/weighted_score_function_builder.rb', line 12 def initialize @weight = DEFAULT_WEIGHT end |
Instance Method Details
#function ⇒ Hash
Returns serialized json query for the object.
17 18 19 20 21 |
# File 'lib/function_scores/weighted_score_function_builder.rb', line 17 def function function = {} function[name.intern] = @weight function end |
#weight(value) ⇒ Object
Sets the weight value.
33 34 35 36 |
# File 'lib/function_scores/weighted_score_function_builder.rb', line 33 def weight(value) @weight = value self end |