Class: Sunspot::Query::TextFieldBoost

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

Overview

:nodoc:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (TextFieldBoost) initialize(field, boost = nil)

A new instance of TextFieldBoost



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

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

Instance Attribute Details

- (Object) boost (readonly)

Returns the value of attribute boost



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

def boost
  @boost
end

Instance Method Details

- (Object) to_boosted_field



10
11
12
13
14
# File 'sunspot/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