Class: Solr::Query::Request::Boosting::FieldValueLessThanBoostFunction

Inherits:
Object
  • Object
show all
Includes:
Support::SchemaHelper
Defined in:
lib/solr/query/request/boosting/field_value_less_than_boost_function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::SchemaHelper

#solarize_field

Constructor Details

#initialize(field:, max:, boost_magnitude:) ⇒ FieldValueLessThanBoostFunction

Returns a new instance of FieldValueLessThanBoostFunction.



10
11
12
13
14
15
# File 'lib/solr/query/request/boosting/field_value_less_than_boost_function.rb', line 10

def initialize(field:, max:, boost_magnitude:)
  @field = field
  @max = max
  @boost_magnitude = boost_magnitude
  freeze
end

Instance Attribute Details

#boost_magnitudeObject (readonly)

Returns the value of attribute boost_magnitude.



8
9
10
# File 'lib/solr/query/request/boosting/field_value_less_than_boost_function.rb', line 8

def boost_magnitude
  @boost_magnitude
end

#fieldObject (readonly)

Returns the value of attribute field.



8
9
10
# File 'lib/solr/query/request/boosting/field_value_less_than_boost_function.rb', line 8

def field
  @field
end

#maxObject (readonly)

Returns the value of attribute max.



8
9
10
# File 'lib/solr/query/request/boosting/field_value_less_than_boost_function.rb', line 8

def max
  @max
end

Instance Method Details

#to_solr_sObject



17
18
19
20
# File 'lib/solr/query/request/boosting/field_value_less_than_boost_function.rb', line 17

def to_solr_s
  solr_field = solarize_field(field)
  "if(sub(#{max},max(#{solr_field},#{max})),1,#{boost_magnitude})"
end