jpountz commented on a change in pull request #172: URL: https://github.com/apache/lucene/pull/172#discussion_r646567016
########## 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: After looking more at the doc values code, I think that unconditionally writing the metadata should fix the test failure we are seeing? This is because seeing that vectors are enabled in field infos would imply that at least one of the to-be-merged segment has vectors, so `subs.size()` would always be at least 1? -- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org