mirror of https://github.com/apache/lucene.git
SOLR-5492: Added shardAddress in grouping query responses. Added tests.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1550143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
09d6a3c73c
commit
bee606588d
|
@ -92,7 +92,9 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
|
|||
if (srsp.getSolrResponse() != null) {
|
||||
nl.add("time", srsp.getSolrResponse().getElapsedTime());
|
||||
}
|
||||
|
||||
if (srsp.getShardAddress() != null) {
|
||||
nl.add("shardAddress", srsp.getShardAddress());
|
||||
}
|
||||
shardInfo.add(srsp.getShard(), nl);
|
||||
}
|
||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
||||
|
|
|
@ -108,7 +108,9 @@ public class TopGroupsShardResponseProcessor implements ShardResponseProcessor {
|
|||
if (srsp.getSolrResponse() != null) {
|
||||
individualShardInfo.add("time", srsp.getSolrResponse().getElapsedTime());
|
||||
}
|
||||
|
||||
if (srsp.getShardAddress() != null) {
|
||||
individualShardInfo.add("shardAddress", srsp.getShardAddress());
|
||||
}
|
||||
shardInfo.add(srsp.getShard(), individualShardInfo);
|
||||
}
|
||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false) && srsp.getException() != null) {
|
||||
|
|
|
@ -507,6 +507,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
// make sure that it responded if it's up
|
||||
if (upShards.contains(s)) {
|
||||
assertTrue("Expected to find numFound in the up shard info",info.get("numFound") != null);
|
||||
assertTrue("Expected to find shardAddress in the up shard info",info.get("shardAddress") != null);
|
||||
}
|
||||
else {
|
||||
assertTrue("Expected to find error in the down shard info",info.get("error") != null);
|
||||
|
|
|
@ -57,6 +57,8 @@ import org.apache.solr.common.cloud.ZkNodeProps;
|
|||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
import org.apache.solr.common.params.CollectionParams.CollectionAction;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.ShardParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.update.DirectUpdateHandler2;
|
||||
import org.apache.solr.util.DefaultSolrThreadFactory;
|
||||
import org.junit.Before;
|
||||
|
@ -243,6 +245,16 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
|
|||
assertEquals(0, collectionClient.query(new SolrQuery("*:*").setParam(_ROUTE_,"b")).getResults().getNumFound());
|
||||
assertEquals(3, collectionClient.query(new SolrQuery("*:*").setParam(_ROUTE_,"a")).getResults().getNumFound());
|
||||
|
||||
// test shards.info with _route_ param
|
||||
QueryResponse resp = collectionClient.query(new SolrQuery("*:*").setParam(_ROUTE_, "a").setParam(ShardParams.SHARDS_INFO, true));
|
||||
NamedList<?> sinfo = (NamedList<?>) resp.getResponse().get(ShardParams.SHARDS_INFO);
|
||||
assertNotNull("missing shard info", sinfo);
|
||||
for (Map.Entry<String,?> entry : sinfo) {
|
||||
NamedList<?> info = (NamedList<?>) entry.getValue();
|
||||
assertTrue("Expected to find numFound in the up shard info",info.get("numFound") != null);
|
||||
assertTrue("Expected to find shardAddress in the up shard info",info.get("shardAddress") != null);
|
||||
}
|
||||
|
||||
collectionClient.deleteByQuery("*:*");
|
||||
collectionClient.commit(true,true);
|
||||
assertEquals(0, collectionClient.query(new SolrQuery("*:*")).getResults().getNumFound());
|
||||
|
|
Loading…
Reference in New Issue