我可以使用solrj执行分布式搜索吗?如果是这样的话,是怎么做的?(注:非solr)
我在这方面找不到任何文档。如果你找到任何/以前用过这个,请帮助我。
发布于 2012-03-12 19:40:51
假设您的分片是:
"localhost:8983/solr“和"localhost:7574/solr”
可以使用solrj执行分布式搜索,如下所示:
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);或者,您可以使用ModifiableSolrParams类:
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);https://stackoverflow.com/questions/9665688
复制相似问题