jimczi 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_r324125480
##########
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:
Can you move this to `updateMinCompetitiveScore` ? If the global minimum
score is equals to the local minimum score we can require the next float value
since we tie-break on doc id and collect in doc id order of the segment. So we
need to reconcile the local minimum score and the global one to call
setMinCompetitiveScore only once.
----------------------------------------------------------------
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]