On 7/9/2019 4:52 PM, Steven White wrote:
In this code sample that's part of my overall code, how do I tell Solr
dynamically / programmatically to use AND or OR as the default operator?

SolrQuery query = new SolrQuery(queryString);
query.setRequestHandler("/select_test");

response = solrClient.query(query);
SolrDocumentList documents = response.getResults();
long count = documents.getNumFound();

At the blank line in the code above, before actually executing the query, add something like this:

query.set("q.op", "OR");

This is doing the same thing as adding &q.op=OR to the URL parameters on a manual request.

Thanks,
Shawn

Reply via email to