You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/12/11 15:13:45 UTC

svn commit: r1550145 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/ solr/core/src/test/org/apache/solr/ solr/core/src/test/org/apache/solr/cloud/

Author: shalin
Date: Wed Dec 11 14:13:44 2013
New Revision: 1550145

URL: http://svn.apache.org/r1550145
Log:
SOLR-5492: Added shardAddress in grouping query responses. Added tests.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java?rev=1550145&r1=1550144&r2=1550145&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/SearchGroupShardResponseProcessor.java Wed Dec 11 14:13:44 2013
@@ -92,7 +92,9 @@ public class SearchGroupShardResponsePro
           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) {

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java?rev=1550145&r1=1550144&r2=1550145&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/TopGroupsShardResponseProcessor.java Wed Dec 11 14:13:44 2013
@@ -108,7 +108,9 @@ public class TopGroupsShardResponseProce
         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) {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedSearch.java?rev=1550145&r1=1550144&r2=1550145&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestDistributedSearch.java Wed Dec 11 14:13:44 2013
@@ -507,6 +507,7 @@ public class TestDistributedSearch exten
           // 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);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java?rev=1550145&r1=1550144&r2=1550145&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java Wed Dec 11 14:13:44 2013
@@ -57,6 +57,8 @@ import org.apache.solr.common.cloud.ZkNo
 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 extend
     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());