cpoerschke commented on code in PR #2348:
URL: https://github.com/apache/solr/pull/2348#discussion_r1530210274


##########
solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java:
##########
@@ -137,4 +140,63 @@ public void ltrNoResultsTest() throws Exception {
     query.add("rq", "{!ltr reRankDocs=3 model=6029760550880411648}");
     assertJQ("/query" + query.toQueryString(), "/response/numFound/==0");
   }
+
+  @Test
+  public void 
ltr_expensiveFeatureRescoring_shouldTimeOutAndReturnPartialResults()
+      throws Exception {
+    /* One SolrFeature is defined: {!func}sleep(1000,999)
+     * It simulates a slow feature extraction, sleeping for 1000ms and 
returning 999 as a score when finished
+     * */
+
+    final String solrQuery = "_query_:{!edismax qf='id' v='8^=10 9^=5 7^=3 
6^=1'}";
+    final SolrQuery query = new SolrQuery();
+    query.setQuery(solrQuery);
+    query.add("fl", "*, score");
+    query.add("rows", "4");
+    query.add("fv", "true");
+    query.add("rq", "{!ltr model=slowModel reRankDocs=3}");
+    query.add("timeAllowed", "300");
+
+    assertJQ(

Review Comment:
   Perhaps we could have an additional `assertJQ` run before or after this with 
(say) `query.setTimeAllowed(5000);` i.e. higher than what is needed, to show 
that `timeAllowed` use works and what this specific query would return if it 
did not run out of time.



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java:
##########
@@ -137,4 +140,63 @@ public void ltrNoResultsTest() throws Exception {
     query.add("rq", "{!ltr reRankDocs=3 model=6029760550880411648}");
     assertJQ("/query" + query.toQueryString(), "/response/numFound/==0");
   }
+
+  @Test
+  public void 
ltr_expensiveFeatureRescoring_shouldTimeOutAndReturnPartialResults()
+      throws Exception {
+    /* One SolrFeature is defined: {!func}sleep(1000,999)
+     * It simulates a slow feature extraction, sleeping for 1000ms and 
returning 999 as a score when finished
+     * */
+
+    final String solrQuery = "_query_:{!edismax qf='id' v='8^=10 9^=5 7^=3 
6^=1'}";
+    final SolrQuery query = new SolrQuery();
+    query.setQuery(solrQuery);
+    query.add("fl", "*, score");
+    query.add("rows", "4");
+    query.add("fv", "true");
+    query.add("rq", "{!ltr model=slowModel reRankDocs=3}");
+    query.add("timeAllowed", "300");

Review Comment:
   minor/style: could use `setTimeAllowed` and `setRows` etc. here it seems e.g.
   ```suggestion
       query.setTimeAllowed(300);
   ```



-- 
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