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_r324162028
########## 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: Ah, understood it now moved, thanks ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org