comdotwang162 commented on a change in pull request #601: URL: https://github.com/apache/lucene/pull/601#discussion_r790382432
########## File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90HnswVectorsWriter.java ########## @@ -110,26 +113,17 @@ @Override public void writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader) throws IOException { + writeVectorDataPadding(); + long vectorDataOffset = vectorData.getFilePointer(); + VectorValues vectors = knnVectorsReader.getVectorValues(fieldInfo.name); - long pos = vectorData.getFilePointer(); - // write floats aligned at 4 bytes. This will not survive CFS, but it shows a small benefit when - // CFS is not used, eg for larger indexes - long padding = (4 - (pos & 0x3)) & 0x3; - long vectorDataOffset = pos + padding; - for (int i = 0; i < padding; i++) { - vectorData.writeByte((byte) 0); - } // TODO - use a better data structure; a bitset? DocsWithFieldSet is p.p. in o.a.l.index - int[] docIds = new int[vectors.size()]; - int count = 0; - for (int docV = vectors.nextDoc(); docV != NO_MORE_DOCS; docV = vectors.nextDoc(), count++) { - // write vector - writeVectorValue(vectors); - docIds[count] = docV; - } + int[] docIds = writeVectorData(vectorData, vectors); Review comment: It seems to me that docids seem to increase continuously when writing and merging -- 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