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
Returns a new instance of ConstantScoreQuery.
185 186 187 188 |
# File 'lib/tire/search/query.rb', line 185 def initialize(&block) @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#boost(boost) ⇒ Object
201 202 203 |
# File 'lib/tire/search/query.rb', line 201 def boost(boost) @value.update(:boost => boost) end |
#filter(type, *options) ⇒ Object
190 191 192 193 194 195 |
# File 'lib/tire/search/query.rb', line 190 def filter(type, *) @value[:filter] ||= {} @value[:filter][:and] ||= [] @value[:filter][:and] << Filter.new(type, *).to_hash @value end |
#query(&block) ⇒ Object
197 198 199 |
# File 'lib/tire/search/query.rb', line 197 def query(&block) @value.update(:query => Query.new(&block).to_hash) end |
#to_hash ⇒ Object
205 206 207 |
# File 'lib/tire/search/query.rb', line 205 def to_hash @value end |