Method: Sunspot::DSL::Scope#any_of
- Defined in:
- lib/sunspot/dsl/scope.rb
#any_of(&block) ⇒ Object
Create a disjunction, scoping the results to documents that match any of the enclosed restrictions.
Example
Sunspot.search(Post) do
any_of do
with(:expired_at).greater_than Time.now
with :expired_at, nil
end
end
This will return all documents who either have an expiration time in the future, or who do not have any expiration time at all.
142 143 144 |
# File 'lib/sunspot/dsl/scope.rb', line 142 def any_of(&block) Util.instance_eval_or_call(Scope.new(@query.add_disjunction), &block) end |