You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2019/10/01 08:12:33 UTC

[GitHub] [lucene-solr] atris commented on a change in pull request #904: LUCENE-8992: Share minimum score across segment in concurrent search

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org