how to set multiple fq while building a query in solrj

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to set multiple fq while building a query in solrj

javaxmlsoapdev

how do I create a query string witih multiple fq params using solrj SolrQuery
API.

e.g. I want to build a query as follow

<a href="http://servername:port/solr/issues/select/?q=testing&fq=statusName:(Female">http://servername:port/solr/issues/select/?q=testing&fq=statusName:(Female
OR Male)&fq=name="Joe"

I am using solrj client APIs to build query and using SolrQuery as follow

solrQuery.setParam("fq" statusString);
solrQuery.setParam("fq", nameString);

It only sets last "fq" (fq=nameString)in the string.. If I swich abover
setParam order it sets fq=statusString. How do I set muliple fq params in
SolrQuery object.

Thanks,
--
View this message in context: http://old.nabble.com/how-to-set-multiple-fq-while-building-a-query-in-solrj-tp26638650p26638650.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: how to set multiple fq while building a query in solrj

Erik Hatcher-4

On Dec 4, 2009, at 4:21 PM, javaxmlsoapdev wrote:

>
> how do I create a query string witih multiple fq params using solrj  
> SolrQuery
> API.
>
> e.g. I want to build a query as follow
>
> <a href="http://servername:port/solr/issues/select/?q=testing&fq=statusName:">http://servername:port/solr/issues/select/?q=testing&fq=statusName: 
> (Female
> OR Male)&fq=name="Joe"
>
> I am using solrj client APIs to build query and using SolrQuery as  
> follow
>
> solrQuery.setParam("fq" statusString);
> solrQuery.setParam("fq", nameString);
>
> It only sets last "fq" (fq=nameString)in the string.. If I swich  
> abover
> setParam order it sets fq=statusString. How do I set muliple fq  
> params in
> SolrQuery object.

Use SolrQuery#add() instead.  Or SolrQuery#addFilterQuery()

        Erik