Class: Solr::Query::Request::Boosting::PhraseProximityBoost

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

Overview

wiki.apache.org/solr/ExtendedDisMax#pf_.28Phrase_Fields.29 solr in action chapter 16.3.5 we only need to do the phrase proximity boosting if we have a phrase, i.e. more than 1 word

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::SchemaHelper

#solarize_field

Constructor Details

#initialize(field:, boost_magnitude:) ⇒ PhraseProximityBoost

Returns a new instance of PhraseProximityBoost.



13
14
15
16
17
# File 'lib/solr/query/request/boosting/phrase_proximity_boost.rb', line 13

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.



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

def boost_magnitude
  @boost_magnitude
end

#fieldObject (readonly)

Returns the value of attribute field.



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

def field
  @field
end

Instance Method Details

#to_solr_sObject



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

def to_solr_s
  solr_field = solarize_field(field)
  "#{solr_field}^#{boost_magnitude}"
end