Class: Tire::Search::DisMaxQuery
- Inherits:
-
Object
- Object
- Tire::Search::DisMaxQuery
- Defined in:
- lib/tire/search/query.rb
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ DisMaxQuery
constructor
A new instance of DisMaxQuery.
- #query(&block) ⇒ Object
- #to_hash ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ DisMaxQuery
Returns a new instance of DisMaxQuery.
186 187 188 189 190 |
# File 'lib/tire/search/query.rb', line 186 def initialize(={}, &block) @options = @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#query(&block) ⇒ Object
192 193 194 195 |
# File 'lib/tire/search/query.rb', line 192 def query(&block) (@value[:queries] ||= []) << Query.new(&block).to_hash @value end |
#to_hash ⇒ Object
197 198 199 |
# File 'lib/tire/search/query.rb', line 197 def to_hash @value.update(@options) end |
#to_json(options = {}) ⇒ Object
201 202 203 |
# File 'lib/tire/search/query.rb', line 201 def to_json(={}) to_hash.to_json end |