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


##########
lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene91/Lucene91HnswVectorsWriter.java:
##########
@@ -149,6 +146,7 @@ public void writeField(FieldInfo fieldInfo, 
KnnVectorsReader knnVectorsReader)
       long vectorIndexLength = vectorIndex.getFilePointer() - 
vectorIndexOffset;
       writeMeta(
           fieldInfo,
+          maxDoc >= 0 ? maxDoc : segmentWriteState.segmentInfo.maxDoc(),

Review Comment:
   It's a bit annoying that we can't have a single source of truth for `maxDoc` 
and need to pick across two.



##########
lucene/core/src/java/org/apache/lucene/codecs/lucene93/Lucene93HnswVectorsWriter.java:
##########
@@ -116,7 +120,236 @@ public final class Lucene93HnswVectorsWriter extends 
KnnVectorsWriter {
   }
 
   @Override
-  public void writeField(FieldInfo fieldInfo, KnnVectorsReader 
knnVectorsReader)
+  public KnnFieldVectorsWriter addField(FieldInfo fieldInfo) throws 
IOException {
+    if (fields == null) {
+      fields = new FieldWriter[1];
+    } else {
+      FieldWriter[] newFields = new FieldWriter[fields.length + 1];
+      System.arraycopy(fields, 0, newFields, 0, fields.length);
+      fields = newFields;
+    }

Review Comment:
   Should we use a list instead of this array which grows in quadratic time?



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