Distributed search using solrj?
Can I do distributed search with solrj? If so, how? (note: not solr)
In this aspect, I cannot find any documentation. Please help me if you find any / have used this before.
+3
Greenhorn
source
to share
1 answer
Assuming your shards are:
"localhost: 8983 / solr" and "localhost: 7574 / solr"
You can do distributed searches with solrj, for example:
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 can 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);
+7
stzoannos
source
to share