Class: Tire::Search::ConstantScoreQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/tire/search/query.rb

Instance Method Summary collapse

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, *options)
  @value.update(:filter => Filter.new(type, *options).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_hashObject



207
208
209
# File 'lib/tire/search/query.rb', line 207

def to_hash
  @value
end