Class: FunctionScores::ScriptScoreFunctionBuilder

Inherits:
ScoreFunctionBuilder show all
Defined in:
lib/function_scores/script_score_function_builder.rb

Overview

A function that uses a script to compute or influence the score of documents that match with the inner query or filter.

Instance Method Summary collapse

Methods inherited from ScoreFunctionBuilder

#name

Methods included from AttributesReader

#attributes

Constructor Details

#initialize(script:) ⇒ ScriptScoreFunctionBuilder

Returns a new instance of ScriptScoreFunctionBuilder.



12
13
14
# File 'lib/function_scores/script_score_function_builder.rb', line 12

def initialize(script:)
  @script = script
end

Instance Method Details

#functionHash

Returns serialized json query for the object.

Returns:

  • (Hash)

    serialized json query for the object



17
18
19
20
21
22
23
# File 'lib/function_scores/script_score_function_builder.rb', line 17

def function
  function = {}
  ss_query = super
  ss_query[:script] = @script.settings
  function[name.intern] = ss_query
  function
end