Acts as solr: Logical Search
There are a couple of ways described in acts_as_solr documentation for the logical search, with AND or OR operations. But I needed to dig a bit into the code as the documentation is not complete and doesn’t suggest all the possible implementations of making the complex Logic Gates for searching.
Here I am consolidating various possibilities of Logical Search…
Find all blogs with category ruby or rails
another way
Find all blogs with categories ruby and rails
another way
Grouping for more precision
NOTE: mind the grouping using parenthesis, you might get unexpected results without proper grouping.
Find all blogs with categories ruby or rails with author Sur
Find all blogs with categories ruby AND rails with author Sur
Find all blogs with categories ruby or rails with author Sur or David
Find all blogs with categories ruby and rails with author Sur or David


Working with Vinsol has been one of the most rewarding and productive collaborations I've ever had in the technology industry. Manik is an intelligent and honest engineer with a great faculty for open and clear communication, and his team include some of the swiftest and keenest developers I've ever had the pleasure to work with. They're great value for money, excellent people who are a joy to know and interact with, and above all they really know their stuff