Can I perform a distributed search using solrj? If so how? (note : not solr)
I don't find any documentation in this aspect. Kindly help me if you find any/have used this before.
Assuming that your shards are:
"localhost:8983/solr" and "localhost:7574/solr"
You may perform a distributed search with solrj like:
String shards = "localhost:8983/solr,localhost:7574/solr";
StringBuffer request = new StringBuffer();
request.append("&q=" + query);
request.append("&shards=" + shards);
SolrParams solrParams = SolrRequestParsers.parseQueryString(request
.toString());
QueryResponse rsp = server.query(solrParams);
alternatively, you may use the ModifiableSolrParams class:
String shards = "localhost:8983/solr,localhost:7574/solr";
ModifiableSolrParams solrParams = new ModifiableSolrParams();
solrParams.set("q", query);
solrParams.set("shards", shards);
QueryResponse rsp = server.query(solrParams);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With