mayya-sharipova commented on a change in pull request #1351: LUCENE-9280: 
Collectors to skip noncompetitive documents
URL: https://github.com/apache/lucene-solr/pull/1351#discussion_r407108032
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/ScoreMode.java
 ##########
 @@ -51,10 +59,51 @@ public boolean needsScores() {
     public boolean needsScores() {
       return true;
     }
+    @Override
+    public boolean isExhaustive() {
+      return false;
+    }
+  },
+
+  /**
+   * ScoreMode for top field collectors that can provide their own iterators,
+   * to optionally allow to skip for non-competitive docs
+   */
+  TOP_DOCS {
+    @Override
+    public boolean needsScores() {
+      return false;
+    }
+    @Override
+    public boolean isExhaustive() {
+      return false;
+    }
+  },
+
+  /**
+   * ScoreMode for top field collectors that can provide their own iterators,
+   * to optionally allow to skip for non-competitive docs.
+   * This mode is used when there is a secondary sort by _score.
+   */
+  TOP_DOCS_WITH_SCORES {
+    @Override
+    public boolean needsScores() {
+      return true;
+    }
+    @Override
+    public boolean isExhaustive() {
+      return false;
+    }
   };
 
   /**
    * Whether this {@link ScoreMode} needs to compute scores.
    */
   public abstract boolean needsScores();
+
+  /**
+   * Returns {@code true} if for this {@link ScoreMode} it is necessary to 
process all documents,
+   * or {@code false} if is enough to go through top documents only.
+   */
+  public abstract boolean isExhaustive();
 
 Review comment:
   @romseygeek Thanks, a very good suggestion, this indeed made the code more 
clear and less verbose.  Addressed in 719882e

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