Class: Sunspot::Query::BoostQuery
- Inherits:
-
Connective::Conjunction
- Object
- Connective::Abstract
- Connective::Conjunction
- Sunspot::Query::BoostQuery
- Defined in:
- lib/sunspot/query/boost_query.rb
Overview
Representation of a BoostQuery, which allows the searcher to specify a scope for which matching documents should have an extra boost. This is essentially a conjunction, with an extra instance variable containing the boost that should be applied.
Instance Method Summary collapse
-
#initialize(boost) ⇒ BoostQuery
constructor
:nodoc:.
- #to_boolean_phrase ⇒ Object
Methods inherited from Connective::Conjunction
Methods inherited from Connective::Abstract
#add_component, #add_conjunction, #add_disjunction, #add_negated_restriction, #add_negated_shorthand_restriction, #add_positive_restriction, #add_positive_shorthand_restriction, #add_restriction, #add_shorthand_restriction, #negate, #negated?
Methods included from Filter
Constructor Details
#initialize(boost) ⇒ BoostQuery
:nodoc:
10 11 12 13 |
# File 'lib/sunspot/query/boost_query.rb', line 10 def initialize(boost) super(false) @boost = boost end |
Instance Method Details
#to_boolean_phrase ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/sunspot/query/boost_query.rb', line 15 def to_boolean_phrase if @boost.is_a?(FunctionQuery) "#{@boost}" else "#{super}^#{@boost}" end end |