kaivalnp commented on code in PR #16705:
URL: https://github.com/apache/lucene/pull/16705#discussion_r4159077761


##########
lucene/core/src/java/org/apache/lucene/index/KnnVectorValues.java:
##########
@@ -50,12 +50,47 @@ public int ordToDoc(int ord) {
   }
 
   /**
-   * Prefetches the provided ordinals
+   * Prefetches {@code count} consecutive vectors starting at the given 
ordinal, so that later calls
+   * to read them are more likely to hit memory. Implementations should start 
the reads and return
+   * without waiting for them, and are free to prefetch fewer vectors than 
asked for, including none
+   * at all. {@code count} is clamped to the number of vectors remaining after 
{@code ord}. The
+   * default implementation is a no-op.
+   *
+   * @param ord the ordinal of the first vector to prefetch
+   * @param count how many consecutive vectors to prefetch, starting at {@code 
ord}
+   * @return true if prefetch actually prefetched something, hence the caller 
can benefit from
+   *     deferring the reads
+   */
+  public boolean prefetch(int ord, int count) throws IOException {
+    return false;
+  }
+
+  /**
+   * Prefetches the provided ordinals. Ordinals that are consecutive in the 
array are prefetched
+   * together with a single call to {@link #prefetch(int, int)}.
    *
    * @param ordsToPrefetch a list of ordinals to prefetch
    * @param numOrds number of ords to prefetch from ordsToPrefetch array
    */
-  public void prefetch(final int[] ordsToPrefetch, int numOrds) throws 
IOException {}
+  public void prefetch(final int[] ordsToPrefetch, int numOrds) throws 
IOException {

Review Comment:
   If `boolean prefetch(int ord, int count)` is the main primitive now, should 
this be marked deprecated and / or final? (the `CHANGES.txt` entry also says it 
is replaced, but the signature is different?)



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