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

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
 ##########
 @@ -318,19 +350,41 @@ private TopFieldCollector(FieldValueHitQueue<Entry> pq, 
int numHits,
       scoreMode = needsScores ? ScoreMode.COMPLETE : 
ScoreMode.COMPLETE_NO_SCORES;
       canSetMinScore = false;
     }
+    this.minScoreAcc = minScoreAcc;
   }
 
   @Override
   public ScoreMode scoreMode() {
     return scoreMode;
   }
 
+  protected void updateGlobalMinCompetitiveScore(Scorable scorer) throws 
IOException {
+    assert minScoreAcc != null;
+    if (canSetMinScore
+          && hitsThresholdChecker.isThresholdReached()) {
+      MaxScoreAccumulator.Result maxMinScore = minScoreAcc.get();
+      if (maxMinScore != null && maxMinScore.score > minCompetitiveScore) {
+        scorer.setMinCompetitiveScore(maxMinScore.score);
+        minCompetitiveScore = maxMinScore.score;
+        totalHitsRelation = TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO;
+      }
+    }
+  }
+
   protected void updateMinCompetitiveScore(Scorable scorer) throws IOException 
{
-    if (canSetMinScore && hitsThresholdChecker.isThresholdReached() && 
queueFull) {
+    if (canSetMinScore
+          && hitsThresholdChecker.isThresholdReached()
+          && queueFull) {
 
 Review comment:
   We do set the min competitive score from other threads if the queue is not 
full but only in `updateGlobalMinCompetitiveScore` where we only check that the 
threshold is reached. We want to control the rate at which we check the global 
minimum score so we don't try to access it here. 

----------------------------------------------------------------
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: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to