jpountz commented on code in PR #13779:
URL: https://github.com/apache/lucene/pull/13779#discussion_r1765122721


##########
lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsWriter.java:
##########
@@ -303,29 +314,45 @@ private 
MergedFloat32VectorValues(List<FloatVectorValuesSub> subs, MergeState me
       }
 
       @Override
-      public int docID() {
-        return docId;
-      }
+      public DocIndexIterator iterator() {
+        return new DocIndexIterator() {
+          private int index = -1;
 
-      @Override
-      public int nextDoc() throws IOException {
-        current = docIdMerger.next();
-        if (current == null) {
-          docId = NO_MORE_DOCS;
-        } else {
-          docId = current.mappedDocID;
-        }
-        return docId;
-      }
+          @Override
+          public int docID() {
+            return docId;
+          }
 
-      @Override
-      public float[] vectorValue() throws IOException {
-        return current.values.vectorValue();
+          @Override
+          public int index() {
+            return index;
+          }
+
+          @Override
+          public int nextDoc() throws IOException {
+            current = docIdMerger.next();
+            if (current == null) {
+              docId = NO_MORE_DOCS;
+              index = NO_MORE_DOCS;
+            } else {
+              docId = current.mappedDocID;
+              ++index;
+            }
+            return docId;
+          }
+
+          @Override
+          public int advance(int target) throws IOException {
+            throw new UnsupportedOperationException();
+          }
+        };
       }
 
       @Override
-      public int advance(int target) {
-        throw new UnsupportedOperationException();
+      public float[] vectorValue(int ord) throws IOException {
+        // FIXME what can we assert here?
+        // assert ord == iterator.index();
+        return current.values.vectorValue(current.index());

Review Comment:
   I had thought we'd fix it by concatenating the vector dictionaries of each 
segment. Then based on the requested vector ordinal, you could compute the 
segment that the vector belongs to via `ReaderUtil#subIndex`.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to