1

I am Constructing a query using SolrJ and I am passing String in key-value pair to query ,but in response I am getting documents with AND operation by default. So how to Use "AND" ,"OR" operators with solrj ?

Here is My code:

    SolrQuery query = new SolrQuery();
    query.set("indent", true);
    query.setParam("fl", "receiptItemRecordId_l");
    query.setQuery("dateOfBirth=1991-9-21,product=dolo ");
    query.setRows(1000);

So the query constructed is below:

indent=true&fl=receiptItemRecordId_l&rows=1000&q=dateOfBirth%3D%221991-09-21T00%3A00%3A00Z%22+%2C+Product_s%3Ddolo

Date is formatted to solrDate format.

Any solution of Setting "AND" "OR" operators using Solrj ?

Thanks

po_taka
  • 1,816
  • 17
  • 27

1 Answers1

0

can you try the following and tell me if this worked for you

query.setQuery("(field1:value1 AND field2:value) OR field3:value3")

ie

query.setQuery("(product:solo AND product:solo2) OR product:solo3")
Periklis Douvitsas
  • 2,431
  • 1
  • 13
  • 14