mayya-sharipova commented on a change in pull request #649: URL: https://github.com/apache/lucene/pull/649#discussion_r805395018
########## File path: lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsWriter.java ########## @@ -206,14 +214,19 @@ private void writeMeta( meta.writeVLong(vectorIndexOffset); meta.writeVLong(vectorIndexLength); meta.writeInt(field.getVectorDimension()); - meta.writeInt(docIds.length); - for (int docId : docIds) { - // TODO: delta-encode, or write as bitset - meta.writeVInt(docId); + + // write docIDs + meta.writeInt(count); + if (docIds == null) { + meta.writeShort((short) -1); // dense marker, each document has a vector value Review comment: No particular reason, just copied it from another file. I've modified the code to use `writeByte` instead in ca9bfb25de247fdcf09a2039ef4b25f6c87d5c6d ########## File path: lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsReader.java ########## @@ -372,7 +393,9 @@ int size() { implements RandomAccessVectorValues, RandomAccessVectorValuesProducer { final int dimension; + final int size; Review comment: Good comment, addressed in ca9bfb25de247fdcf09a2039ef4b25f6c87d5c6d ########## File path: lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsWriter.java ########## @@ -138,9 +140,20 @@ public void writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader) long vectorIndexOffset = vectorIndex.getFilePointer(); // build the graph using the temporary vector data + int count = docsWithField.cardinality(); + int[] docIds = null; + if (count < maxDoc) { Review comment: Makes sense to be, I've reverted in ca9bfb25de247fdcf09a2039ef4b25f6c87d5c6d to use the previous approach in with added comment. -- 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