Class: Tire::Search::BoostingQuery
- Inherits:
-
Object
- Object
- Tire::Search::BoostingQuery
- Defined in:
- lib/tire/search/query.rb
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ BoostingQuery
constructor
A new instance of BoostingQuery.
- #negative(&block) ⇒ Object
- #positive(&block) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ BoostingQuery
Returns a new instance of BoostingQuery.
253 254 255 256 257 |
# File 'lib/tire/search/query.rb', line 253 def initialize(={}, &block) @options = @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#negative(&block) ⇒ Object
264 265 266 267 |
# File 'lib/tire/search/query.rb', line 264 def negative(&block) (@value[:negative] ||= []) << Query.new(&block).to_hash @value end |
#positive(&block) ⇒ Object
259 260 261 262 |
# File 'lib/tire/search/query.rb', line 259 def positive(&block) (@value[:positive] ||= []) << Query.new(&block).to_hash @value end |
#to_hash ⇒ Object
269 270 271 |
# File 'lib/tire/search/query.rb', line 269 def to_hash @value.update(@options) end |