Class: Sunspot::Query::TextFieldBoost

Inherits:
Object
  • Object
show all
Defined in:
lib/sunspot/query/text_field_boost.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, boost = nil) ⇒ TextFieldBoost

Returns a new instance of TextFieldBoost.



6
7
8
# File 'lib/sunspot/query/text_field_boost.rb', line 6

def initialize(field, boost = nil)
  @field, @boost = field, boost
end

Instance Attribute Details

#boostObject (readonly)

Returns the value of attribute boost.



4
5
6
# File 'lib/sunspot/query/text_field_boost.rb', line 4

def boost
  @boost
end

Instance Method Details

#to_boosted_fieldObject



10
11
12
13
14
# File 'lib/sunspot/query/text_field_boost.rb', line 10

def to_boosted_field
  boosted_field = @field.indexed_name
  boosted_field.concat("^#{@boost}") if @boost
  boosted_field
end