passing comma separated values in filter query of solr response

goblin2986 picture goblin2986 · Mar 14, 2011 · Viewed 17.1k times · Source

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

Answer

nikhil500 picture nikhil500 · Mar 14, 2011

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.)