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

Share this: