class FunctionScores::RandomScoreFunctionBuilder
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
Constants
- NAME
@!visibility protected
Public Instance Methods
field(value)
click to toggle source
@params [String] field name Sets the field value. @return [RandomScoreFunctionBuilder] modified self
# File lib/function_scores/random_score_function_builder.rb, line 48 def field(value) @field = value self end
field_expr()
click to toggle source
@!visibility protected Returns the field value.
# File lib/function_scores/random_score_function_builder.rb, line 40 def field_expr @field end
function()
click to toggle source
@return [Hash] serailized json query for the object
Calls superclass method
# 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)
click to toggle source
@params [Numeric] Seed Value Sets the seed value. @return [RandomScoreFunctionBuilder] modified self
# File lib/function_scores/random_score_function_builder.rb, line 33 def seed(value) @seed = value self end
seed_expr()
click to toggle source
@!visibility protected Returns the seed value.
# File lib/function_scores/random_score_function_builder.rb, line 25 def seed_expr @seed end