ChrisHegarty commented on code in PR #16647:
URL: https://github.com/apache/lucene/pull/16647#discussion_r3949467036
##########
lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseKnnVectorsFormatTestCase.java:
##########
@@ -2499,10 +2588,41 @@ protected void assertOffHeapByteSize(LeafReader r,
String fieldName) throws IOEx
protected static int getNumVectors(KnnVectorsReader reader, FieldInfo
fieldInfo)
throws IOException {
+ return reader.getVectorCount(fieldInfo);
+ }
+
+ protected void assertVectorCountMatchesVectorValuesSize(LeafReader
leafReader)
+ throws IOException {
+ if (leafReader instanceof CodecReader codecReader) {
+ KnnVectorsReader vectorsReader = codecReader.getVectorReader();
+ for (FieldInfo fieldInfo : leafReader.getFieldInfos()) {
+ if (fieldInfo.getVectorDimension() <= 0) {
+ continue;
+ }
+ KnnVectorsReader fieldReader =
vectorsReader.unwrapReaderForField(fieldInfo.name);
Review Comment:
I updated assertVectorCountMatchesVectorValuesSize to assert both paths for
each field. And testVectorCount now also runs the assertion on
SlowCodecReaderWrapper.wrap(...) and SortingCodecReader.wrap(...).
I also added TestGetVectorCountCodecWrappers, to cover the package-private
SlowCompositeCodecReaderWrapper.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]