how to search for more than one facet in solr?

I need to search for facets in solr as below:

  • fq=country:usa
  • fq=country:canada
  • fq=topic:industrial
  • fq=topic:political


now i need to search for the articles that have the above facets (logical And) and (logical Or).
suppose that i have the following articles

  1. country=USA France //Topic: Industrial Scientific
  2. country=USA canada //Topic: Industrial
  3. country=USA canada //Topic: Industrial political

now, i have tried*:*&start=0&rows=10&facet=true&fq=country:USA&fq=country:canada&fq=topic:political&fq=topic:industrial

but this didnt return anything :( could you please guide me to how to search for those faces by ANDing and ORing between them

asked May 16, 2015 in SOLR by rajesh
0 votes

1 Answer

0 votes
Best answer
You can use boolean operators to filter the results.

OR - fq=country:(USA OR canada)&fq=topic:(political OR industrial)

AND - fq=country:(USA AND canada)&fq=topic:(political AND industrial)
answered May 16, 2015 by rajesh