chlorochrule commented on code in PR #937:
URL: https://github.com/apache/solr/pull/937#discussion_r921131573


##########
solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java:
##########
@@ -322,6 +323,43 @@ public void testSimpleQuery() throws Exception {
     assertEquals(result7_features, 
queryResponse.getResults().get(7).get("features").toString());
   }
 
+  @Test
+  public void testInterleaving() throws Exception {
+    SolrQuery query = new SolrQuery("{!func}sub(8,field(popularity))");
+    query.setRequestHandler("/query");
+    query.setFields("*,score,[interleaving]");
+    query.add(
+        "rq",
+        "{!ltr model=powpularityS-model 
model=powpularityS-model-for-interleaving reRankDocs=8}");
+
+    solrCluster
+        .getSolrClient()
+        .query(
+            COLLECTION,
+            query); // NullPointerException at 
LTRInterleavingTransformerFactory.java:103
+  }

Review Comment:
   This test fails with NPE



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java:
##########
@@ -322,6 +323,43 @@ public void testSimpleQuery() throws Exception {
     assertEquals(result7_features, 
queryResponse.getResults().get(7).get("features").toString());
   }
 
+  @Test
+  public void testInterleaving() throws Exception {
+    SolrQuery query = new SolrQuery("{!func}sub(8,field(popularity))");
+    query.setRequestHandler("/query");
+    query.setFields("*,score,[interleaving]");
+    query.add(
+        "rq",
+        "{!ltr model=powpularityS-model 
model=powpularityS-model-for-interleaving reRankDocs=8}");
+
+    solrCluster
+        .getSolrClient()
+        .query(
+            COLLECTION,
+            query); // NullPointerException at 
LTRInterleavingTransformerFactory.java:103
+  }
+
+  @Test
+  public void testInterleavingWithDistribSinglePass() throws Exception {
+    SolrQuery query = new SolrQuery("{!func}sub(8,field(popularity))");
+    query.setRequestHandler("/query");
+    query.setFields("*,score,[interleaving]");
+    query.add(
+        "rq",
+        "{!ltr model=powpularityS-model 
model=powpularityS-model-for-interleaving reRankDocs=8}");
+    query.setParam(ShardParams.DISTRIB_SINGLE_PASS, true);
+
+    QueryResponse queryResponse =
+        solrCluster.getSolrClient().query(COLLECTION, query); // works well
+    assertTrue(
+        queryResponse
+            .getResults()
+            .get(0)
+            .getFieldValue("[interleaving]")
+            .toString()
+            .startsWith("powpularityS-model"));
+  }

Review Comment:
   This test doesn't fail because distrib.singlePass=true parameter is specified



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTROnSolrCloud.java:
##########
@@ -322,6 +323,29 @@ public void testSimpleQuery() throws Exception {
     assertEquals(result7_features, 
queryResponse.getResults().get(7).get("features").toString());
   }
 
+  @Test
+  public void testInterleaving() throws Exception {
+    SolrQuery query = new SolrQuery("{!func}sub(8,field(popularity))");
+    query.setRequestHandler("/query");
+    query.setFields("*,score,[interleaving]");
+    query.add("rq", "{!ltr model=powpularityS-model 
model=powpularityS-model-for-interleaving reRankDocs=8}");
+
+    solrCluster.getSolrClient().query(COLLECTION, query);  // 
NullPointerException at LTRInterleavingTransformerFactory.java:103
+  }
+
+  @Test
+  public void testInterleavingWithDistribSinglePass() throws Exception {
+    SolrQuery query = new SolrQuery("{!func}sub(8,field(popularity))");
+    query.setRequestHandler("/query");
+    query.setFields("*,score,[interleaving]");
+    query.add("rq", "{!ltr model=powpularityS-model 
model=powpularityS-model-for-interleaving reRankDocs=8}");
+    query.setParam(ShardParams.DISTRIB_SINGLE_PASS, true);
+
+    QueryResponse queryResponse = 
solrCluster.getSolrClient().query(COLLECTION, query);  // works well
+    assertTrue(queryResponse.getResults()
+        
.get(0).getFieldValue("[interleaving]").toString().startsWith("powpularityS-model"));
+  }

Review Comment:
   This test doesn't fail because `distrib.singlePass=true` parameter is 
specified



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to