You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/06/07 12:11:44 UTC

[GitHub] [lucene] msokolov commented on a change in pull request #172: LUCENE-9992: write empty vector fields when merging

msokolov commented on a change in pull request #172:
URL: https://github.com/apache/lucene/pull/172#discussion_r646529427



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/VectorWriter.java
##########
@@ -104,9 +104,12 @@ private void mergeVectors(FieldInfo mergeFieldInfo, final MergeState mergeState)
         }
       }
     }
-    // Create a new VectorValues by iterating over the sub vectors, mapping the resulting
-    // docids using docMaps in the mergeState.
-    if (subs.size() > 0) {
+    if (subs.size() == 0) {
+      // all segments being merged have no vectors
+      writeField(mergeFieldInfo, VectorValues.EMPTY);
+    } else {
+      // Create a new VectorValues by iterating over the sub vectors, mapping the resulting
+      // docids using docMaps in the mergeState.
       writeField(mergeFieldInfo, new VectorValuesMerger(subs, mergeState));
     }

Review comment:
       Hm, no, it throws an NPE in DocIDMerger.next(); if you create a DocIDMerger with an empty List and then call next(), you get an NPE.




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

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



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