class FunctionScores::WeightedScoreFunctionBuilder

A query that multiplies the weight to the score.

Constants

DEFAULT_WEIGHT

@!visibility protected

NAME

@!visibility protected

Public Class Methods

new() click to toggle source
# File lib/function_scores/weighted_score_function_builder.rb, line 12
def initialize
  @weight = DEFAULT_WEIGHT
end

Public Instance Methods

function() click to toggle source

@return [Hash] serialized json query for the object

# File lib/function_scores/weighted_score_function_builder.rb, line 17
def function
  function = {}
  function[name.intern] = @weight
  function
end
weight(value) click to toggle source

@params [Numeric] value weight for the weighted function Sets the weight value. @returns [WeightedScoreFunctionBuilder]

modified self
# File lib/function_scores/weighted_score_function_builder.rb, line 33
def weight(value)
  @weight = value
  self
end
weight_expr() click to toggle source

Returns the weight value @!visibility protected

# File lib/function_scores/weighted_score_function_builder.rb, line 25
def weight_expr
  @weight
end