Reputation: 6435
I have a Sunspot/SOLR implementation with some text fields that I want to search for "Term A" or "Term B". I can't figure out how to do this.
s = Product.search do
any_of do
fulltext "Term A"
fulltext "Term B"
end
end
Does not work (all records are returned).
I don't see how this would work directly in SOLR nor do I see how it could work via Sunspot.
Upvotes: 2
Views: 314
Reputation: 41
Yes, it doesn't work. But you could use logically expression instead.
Like "AND" "OR" "+" "-" ... etc.
In you case, try
s = Product.search do
fulltext "Term A OR Term B"
end
It's works to me.
Upvotes: 3