weiwang19 commented on code in PR #2046:
URL: https://github.com/apache/solr/pull/2046#discussion_r1408099532


##########
solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java:
##########
@@ -263,4 +267,51 @@ private void addDocsRandomly() throws IOException, 
SolrServerException {
     solrCluster.getSolrClient().commit("collection1_local");
     solrCluster.getSolrClient().commit("collection2_local");
   }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testDisableDistribStats() throws Exception {
+
+    // single collection with implicit router
+    createCollection(COLLECTION, "conf1", ImplicitDocRouter.NAME);
+    SolrClient client = solrCluster.getSolrClient();
+
+    SolrInputDocument doc = new SolrInputDocument();
+    doc.setField("id", "1");
+    doc.setField("cat", "tv");
+    doc.addField(ShardParams._ROUTE_, "a");
+    client.add(COLLECTION, doc);
+
+    doc = new SolrInputDocument();
+    doc.setField("id", "2");
+    doc.setField("cat", "ipad");
+    doc.addField(ShardParams._ROUTE_, "b");
+    client.add(COLLECTION, doc);
+
+    // distributed stats implicitly enabled by default
+    SolrQuery query =
+        new SolrQuery(
+            "q", "*:*",
+            "fl", "id",
+            "fq", "{!terms f=id}1,2",
+            "debug", "track");
+    QueryResponse rsp = client.query(COLLECTION, query);
+    NamedList<Object> track = (NamedList<Object>) 
rsp.getDebugMap().get("track");
+    assertNotNull(track);
+    assertNotNull(track.get("PARSE_QUERY"));
+
+    // distributed stats explicitly disabled
+    query.set(CommonParams.DISABLE_DISTRIB_STATS, "true");
+    rsp = client.query(COLLECTION, query);
+    track = (NamedList<Object>) rsp.getDebugMap().get("track");
+    assertNotNull(track);
+    assertNull(track.get("PARSE_QUERY"));
+
+    // distributed stats explicitly enabled
+    query.set(CommonParams.DISABLE_DISTRIB_STATS, "false");
+    rsp = client.query(COLLECTION, query);
+    track = (NamedList<Object>) rsp.getDebugMap().get("track");
+    assertNotNull(track);
+    assertNotNull(track.get("PARSE_QUERY"));

Review Comment:
   adjusted test query



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to