Class: FunctionScores::RandomScoreFunctionBuilder
- Inherits:
-
ScoreFunctionBuilder
- Object
- ScoreFunctionBuilder
- FunctionScores::RandomScoreFunctionBuilder
- Defined in:
- lib/function_scores/random_score_function_builder.rb
Overview
A function that computes a random score for the matched documents
Query Components:
seed: Seed value based on which the random number will be generated
field: Field value based on which the random number will be generated
Instance Method Summary collapse
-
#field(value) ⇒ RandomScoreFunctionBuilder
Sets the field value.
-
#function ⇒ Hash
Serailized json query for the object.
-
#seed(value) ⇒ RandomScoreFunctionBuilder
Sets the seed value.
Methods inherited from ScoreFunctionBuilder
Methods included from AttributesReader
Instance Method Details
#field(value) ⇒ RandomScoreFunctionBuilder
Sets the field value. modified self
48 49 50 51 |
# File 'lib/function_scores/random_score_function_builder.rb', line 48 def field(value) @field = value self end |
#function ⇒ Hash
Returns serailized json query for the object.
14 15 16 17 18 19 20 21 |
# File 'lib/function_scores/random_score_function_builder.rb', line 14 def function function = {} rs_query = super rs_query[:field] = @field if field.present? rs_query[:seed] = @seed if seed.present? function[name.intern] = rs_query function end |
#seed(value) ⇒ RandomScoreFunctionBuilder
Sets the seed value. modified self
33 34 35 36 |
# File 'lib/function_scores/random_score_function_builder.rb', line 33 def seed(value) @seed = value self end |