Class: Elasticband::Query::ScoreFunction::FieldValueFactor

Inherits:
Elasticband::Query::ScoreFunction show all
Defined in:
lib/elasticband/query/score_function/field_value_factor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, options = {}) ⇒ FieldValueFactor

Returns a new instance of FieldValueFactor.



7
8
9
10
# File 'lib/elasticband/query/score_function/field_value_factor.rb', line 7

def initialize(field, options = {})
  self.field = field.to_sym
  self.options = options
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



5
6
7
# File 'lib/elasticband/query/score_function/field_value_factor.rb', line 5

def field
  @field
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/elasticband/query/score_function/field_value_factor.rb', line 5

def options
  @options
end

Instance Method Details

#to_hObject



12
13
14
# File 'lib/elasticband/query/score_function/field_value_factor.rb', line 12

def to_h
  { field_value_factor: function_hash }
end