Class: Solr::Query::Request::Boosting::ExistsBoostFunction

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::SchemaHelper

#solarize_field

Constructor Details

#initialize(field:, boost_magnitude:) ⇒ ExistsBoostFunction

Returns a new instance of ExistsBoostFunction.



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

def initialize(field:, boost_magnitude:)
  @field = field
  @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/exists_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/exists_boost_function.rb', line 8

def field
  @field
end

Instance Method Details

#solr_fieldObject



20
21
22
# File 'lib/solr/query/request/boosting/exists_boost_function.rb', line 20

def solr_field
  solarize_field(field)
end

#to_solr_sObject



16
17
18
# File 'lib/solr/query/request/boosting/exists_boost_function.rb', line 16

def to_solr_s
  "if(exists(#{solr_field}),#{boost_magnitude},1)"
end