atris commented on a change in pull request #904: LUCENE-8992: Share minimum 
score across segment in concurrent search
URL: https://github.com/apache/lucene-solr/pull/904#discussion_r329924525
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
 ##########
 @@ -318,18 +327,35 @@ private TopFieldCollector(FieldValueHitQueue<Entry> pq, 
int numHits,
       scoreMode = needsScores ? ScoreMode.COMPLETE : 
ScoreMode.COMPLETE_NO_SCORES;
       canSetMinScore = false;
     }
+    this.bottomValueChecker = bottomValueChecker;
   }
 
   @Override
   public ScoreMode scoreMode() {
     return scoreMode;
   }
 
+  protected boolean shouldUpdateMinScore() {
+    return bottomValueChecker != null ? bottomValueChecker.getBottomValue() > 
minScore : false;
+  }
+
   protected void updateMinCompetitiveScore(Scorable scorer) throws IOException 
{
-    if (canSetMinScore && hitsThresholdChecker.isThresholdReached() && 
queueFull) {
-      assert bottom != null && firstComparator != null;
-      float minScore = firstComparator.value(bottom.slot);
-      scorer.setMinCompetitiveScore(minScore);
+    if (canSetMinScore && hitsThresholdChecker.isThresholdReached()
+          && (queueFull || (bottomValueChecker != null && 
bottomValueChecker.getBottomValue() > 0f))) {
+      float maxMinScore = Float.NEGATIVE_INFINITY;
+      if (queueFull) {
+        assert bottom != null && firstComparator != null;
+        maxMinScore = firstComparator.value(bottom.slot);
+        if (bottomValueChecker != null) {
+          bottomValueChecker.updateThreadLocalBottomValue(maxMinScore);
+        }
+      }
+      if (bottomValueChecker != null) {
 
 Review comment:
   Do we need these checks again, since we could have gotten here if 
`shouldUpdateMinScore` returned true, which would signal that the global score 
is better than local minimum?

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