class Tire::Search::FilteredQuery

Public Class Methods

new(&block) click to toggle source
# File lib/tire/search/query.rb, line 158
def initialize(&block)
  @value = {}
  block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given?
end

Public Instance Methods

filter(type, *options) click to toggle source
# File lib/tire/search/query.rb, line 168
def filter(type, *options)
  @value[:filter] ||= {}
  @value[:filter][:and] ||= []
  @value[:filter][:and] << Filter.new(type, *options).to_hash
  @value
end
query(options={}, &block) click to toggle source
# File lib/tire/search/query.rb, line 163
def query(options={}, &block)
  @value[:query] = Query.new(&block).to_hash
  @value
end
to_hash() click to toggle source
# File lib/tire/search/query.rb, line 175
def to_hash
  @value
end
to_json(options={}) click to toggle source
# File lib/tire/search/query.rb, line 179
def to_json(options={})
  to_hash.to_json
end