18

I want to pass comma separated values in filter query (fq) of solr response, currently when i want to pass multiple categories i use OR operator. like this fq=categoryId:3 OR categoryId:55 OR categoryId:34

is there any solution to pass values like fq=categoryId:3,55,34

Cœur
  • 37,241
  • 25
  • 195
  • 267
goblin2986
  • 971
  • 3
  • 16
  • 32

2 Answers2

30

fq=categoryId:(3 55 34) should work if your default operator is OR. Else, try fq=categoryId:(3 OR 55 OR 34). This is called Field Grouping in the Lucene query syntax. (Solr supports the full Lucene syntax as documented here.)

nikhil500
  • 3,458
  • 19
  • 23
1

if your field for filter query is of type text or string, you can also use fq=categoryId:(IN 3 55 34 44) as well. But IN operator will not work with integer fileds or other then string/text fields.