LUCENE-9992: Update expectations about vectors with no values.

This commit is contained in:
Adrien Grand 2021-06-09 18:59:14 +02:00
parent 465cb17d2b
commit f5e050bd00
2 changed files with 2 additions and 4 deletions

View File

@ -80,9 +80,7 @@ public class SimpleTextVectorWriter extends VectorWriter {
docIds.add(docV); docIds.add(docV);
} }
long vectorDataLength = vectorData.getFilePointer() - vectorDataOffset; long vectorDataLength = vectorData.getFilePointer() - vectorDataOffset;
if (vectorDataLength > 0) { writeMeta(fieldInfo, vectorDataOffset, vectorDataLength, docIds);
writeMeta(fieldInfo, vectorDataOffset, vectorDataLength, docIds);
}
} }
private void writeVectorValue(VectorValues vectors) throws IOException { private void writeVectorValue(VectorValues vectors) throws IOException {

View File

@ -91,7 +91,7 @@ public class AssertingVectorFormat extends VectorFormat {
VectorValues values = delegate.getVectorValues(field); VectorValues values = delegate.getVectorValues(field);
if (values != null) { if (values != null) {
assert values.docID() == -1; assert values.docID() == -1;
assert values.size() > 0; assert values.size() >= 0;
assert values.dimension() > 0; assert values.dimension() > 0;
assert values.similarityFunction() != null; assert values.similarityFunction() != null;
} }