jainankitk commented on code in PR #15382:
URL: https://github.com/apache/lucene/pull/15382#discussion_r2476083112


##########
lucene/core/src/java/org/apache/lucene/search/LeafCollector.java:
##########
@@ -123,6 +123,31 @@ default void collect(DocIdStream stream) throws 
IOException {
     stream.forEach(this::collect);
   }
 
+  /**
+   * Bulk-collect doc IDs.
+   *
+   * <p>Note: The provided int[] may be reused across calls and should be 
consumed immediately.
+   *
+   * <p>Note: The provided int[] typically only holds a small subset of query 
matches. This method
+   * may be called multiple times per segment.
+   *
+   * <p>Like {@link #collect(int)}, it is guaranteed that doc IDs get 
collected in order, ie. doc
+   * IDs are collected in order within a int[], and if called twice, all doc 
IDs from the second
+   * int[] will be greater than all doc IDs from the first int[].
+   *
+   * <p>It is legal for callers to mix calls to {@link #collect(int[], int)}, 
{@link
+   * #collect(DocIdStream)} and {@link #collect(int)}.
+   *
+   * <p>The default implementation calls {@code for(int i = 0; i < count; ++i) 
{ collect(docs[i]);
+   * }; }.
+   */
+  default void collect(int[] docs, int count) throws IOException {
+    for (int i = 0; i < count; ++i) {
+      collect(docs[i]);
+    }

Review Comment:
   I was hoping that `LeafCollector` implementations override this method only 
if they don't need access to the score, but I guess it won't work as the 
underlying iterator already moved onto the next document



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to