ChrisHegarty commented on code in PR #16647:
URL: https://github.com/apache/lucene/pull/16647#discussion_r3949474282


##########
lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsReader.java:
##########
@@ -185,6 +185,27 @@ public KnnVectorsReader getMergeInstance() throws 
IOException {
    */
   public void finishMerge() throws IOException {}
 
+  /**
+   * Returns the number of indexed vectors for the given field in this segment.
+   *
+   * <p>This has the same meaning as {@code get*VectorValues(field).size()}: 
the number of vector
+   * ordinals stored for {@code fieldInfo} in this segment.
+   *
+   * <p>Standard vector formats read this from segment metadata without 
opening vector values. The
+   * default implementation opens vector values as a fallback; callers that 
need to avoid that I/O
+   * should use a reader that overrides this method.
+   *
+   * @param fieldInfo the fieldInfo
+   * @return the number of indexed vectors for the field
+   */
+  public int getVectorCount(FieldInfo fieldInfo) throws IOException {

Review Comment:
   Good idea. I updated the Javadoc with @throws IllegalArgumentException and 
the I/O/prefetch motivation.



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