atris commented on a change in pull request #877: LUCENE-8978: Maximal Bottom 
Score Based Early Termination
URL: https://github.com/apache/lucene-solr/pull/877#discussion_r324141173
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
 ##########
 @@ -74,11 +75,25 @@ public void collect(int doc) throws IOException {
           totalHits++;
           hitsThresholdChecker.incrementHitCount();
 
-          if (score <= pqTop.score) {
+          boolean nonCompetitiveHit;
+          if (bottomValueChecker != null && 
bottomValueChecker.isGlobalBottomValueAvailable()) {
+            nonCompetitiveHit = score <= (float) 
bottomValueChecker.getBottomValue();
+          } else {
+            nonCompetitiveHit = score <= pqTop.score;
+          }
+
+          if (nonCompetitiveHit) {
             if (totalHitsRelation == TotalHits.Relation.EQUAL_TO && 
hitsThresholdChecker.isThresholdReached()) {
               // we just reached totalHitsThreshold, we can start setting the 
min
               // competitive score now
               updateMinCompetitiveScore(scorer);
+
+              // Since the queue is prepopulated with sentinel objects, 
getting here means that the local
+              // priority queue is full
+              if (bottomValueChecker != null) {
+                bottomValueChecker.updateThreadLocalBottomValue(pqTop.score);
+                scorer.setMinCompetitiveScore((float) 
bottomValueChecker.getBottomValue());
 
 Review comment:
   If the global minimum score is equal to the local minimum score, should we 
not be discarding this document, because, as you said, we collect in docID 
order?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to