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


##########
solr/modules/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java:
##########
@@ -233,7 +235,14 @@ protected static boolean scoreSingleHit(
     boolean logHit = false;
 
     scorer.getDocInfo().setOriginalDocScore(hit.score);
+    QueryLimits queryLimits = QueryLimits.getCurrentLimits();
     hit.score = scorer.score();
+    if (queryLimits.maybeExitWithPartialResults(

Review Comment:
   This method doesn't throw exception and returns a boolean only when partial 
results are acceptable - meaning that since we already computed some expensive 
results we can still decide here to return them if we want to. We can also 
return with empty results if nothing was computed yet.
   However, the method `maybeExitWithPartialResults` will throw an exception if 
the user decided he doesn't want partial results (by setting request param 
`partialResults=false`) - so we don't need to explicitly throw any exception 
here.



##########
solr/modules/ltr/src/java/org/apache/solr/ltr/LTRRescorer.java:
##########
@@ -233,7 +235,14 @@ protected static boolean scoreSingleHit(
     boolean logHit = false;
 
     scorer.getDocInfo().setOriginalDocScore(hit.score);
+    QueryLimits queryLimits = QueryLimits.getCurrentLimits();
     hit.score = scorer.score();
+    if (queryLimits.maybeExitWithPartialResults(
+        "Learning To Rank rescoring -"
+            + " The full reranking didn't complete and got reverted."
+            + " All documents preserved their original score and ranking.")) {
+      throw new QueryLimitsExceededException("The Time Allowed has been 
exceeded when rescoring");

Review Comment:
   It's not necessarily `timeAllowed` now ... any other limit may have been 
exceeded. A better wording would be "A query limit has been exceeded".



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