Class: Tire::Search::ConstantScoreQuery
- Inherits:
-
Object
- Object
- Tire::Search::ConstantScoreQuery
- Defined in:
- lib/tire/search/query.rb
Instance Method Summary collapse
- #boost(boost) ⇒ Object
- #filter(type, *options) ⇒ Object
-
#initialize(&block) ⇒ ConstantScoreQuery
constructor
A new instance of ConstantScoreQuery.
- #query(&block) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(&block) ⇒ ConstantScoreQuery
190 191 192 193 |
# File 'lib/tire/search/query.rb', line 190 def initialize(&block) @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#boost(boost) ⇒ Object
203 204 205 |
# File 'lib/tire/search/query.rb', line 203 def boost(boost) @value.update(:boost => boost) end |
#filter(type, *options) ⇒ Object
195 196 197 |
# File 'lib/tire/search/query.rb', line 195 def filter(type, *) @value.update(:filter => Filter.new(type, *).to_hash) end |
#query(&block) ⇒ Object
199 200 201 |
# File 'lib/tire/search/query.rb', line 199 def query(&block) @value.update(:query => Query.new(&block).to_hash) end |
#to_hash ⇒ Object
207 208 209 |
# File 'lib/tire/search/query.rb', line 207 def to_hash @value end |