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

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
 ##########
 @@ -93,4 +93,16 @@
    */
   void collect(int doc) throws IOException;
 
+  /**
+   * Optionally creates a view of the scorerIterator where only competitive 
documents
+   * in the scorerIterator are kept and non-competitive are skipped.
+   *
+   * Collectors should delegate this method to their comparators if
+   * their comparators provide the skipping functionality over non-competitive 
docs.
+   * The default is to return the same iterator which is interpreted as the 
collector doesn't filter any documents.
+   */
+  default DocIdSetIterator filterIterator(DocIdSetIterator scorerIterator) {
+    return scorerIterator;
+  }
 
 Review comment:
   This allows for some hacks like returning an iterator that matches more 
hacks than the scorer. I liked the previous approach that returned an iterator 
better.

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