Class: Sunspot::Query::BoostQuery

Inherits:
Connective::Conjunction show all
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

Methods inherited from Connective::Conjunction

#add_conjunction, inverse

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

#tag, #to_filter_query

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_phraseObject



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