alessandrobenedetti commented on code in PR #12314:
URL: https://github.com/apache/lucene/pull/12314#discussion_r1244453767


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene95/Lucene95HnswVectorsWriter.java:
##########
@@ -822,40 +836,37 @@ private void writeMeta(
    * Writes the byte vector values to the output and returns a set of 
documents that contains
    * vectors.
    */
-  private static DocsWithFieldSet writeByteVectorData(
-      IndexOutput output, ByteVectorValues byteVectorValues) throws 
IOException {
-    DocsWithFieldSet docsWithField = new DocsWithFieldSet();
-    for (int docV = byteVectorValues.nextDoc();
-        docV != NO_MORE_DOCS;
-        docV = byteVectorValues.nextDoc()) {
-      // write vector
-      byte[] binaryValue = byteVectorValues.vectorValue();
-      assert binaryValue.length == byteVectorValues.dimension() * 
VectorEncoding.BYTE.byteSize;
+  private static DocsWithVectorsSet writeByteVectorData(
+      IndexOutput output, ByteVectorValues mergedVectorValues) throws 
IOException {
+    DocsWithVectorsSet docsWithVectors = new DocsWithVectorsSet();
+    for (int vectorId = mergedVectorValues.nextDoc(); vectorId != 
NO_MORE_DOCS; vectorId = mergedVectorValues.nextDoc()) {
+      int docID = mergedVectorValues.ordToDoc(vectorId);
+      byte[] binaryValue = mergedVectorValues.vectorValue();
+      assert binaryValue.length == mergedVectorValues.dimension() * 
VectorEncoding.BYTE.byteSize;
       output.writeBytes(binaryValue, binaryValue.length);
-      docsWithField.add(docV);
+      docsWithVectors.add(docID);
     }
-    return docsWithField;
+    return docsWithVectors;

Review Comment:
   As far as I wanted and hopefully implemented we get the document order for 
free since all vectors have to be supplied at the same time.
   As everything in this Pull Request, it's open to discussion as my focus was 
to bring a starting milestone working end to end and then refine each step.



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