With upgrade to Lucene 9.12, Lucene started exposing the FlatVectorsFormat as KnnVectorsFormat. With this FlatFieldVectorsWriter now exposes DocsWithFieldSet and vectors which are added in the FlatFieldVectorsWriter during flush.
Now NativeEngineFieldVectorsWriter and FlatFieldVectorsWriter stores the same reference of vectors and docIds, which is not required. We can completely get rid of reference of vectors and docIds from NativeEngineFieldVectorsWriter and just use FlatFieldVectorsWriter during flush. This will simplify the code and will also free up some resources from heap.
Description
With upgrade to Lucene 9.12, Lucene started exposing the FlatVectorsFormat as KnnVectorsFormat. With this FlatFieldVectorsWriter now exposes
DocsWithFieldSet
andvectors
which are added in the FlatFieldVectorsWriter during flush.Now NativeEngineFieldVectorsWriter and FlatFieldVectorsWriter stores the same reference of vectors and docIds, which is not required. We can completely get rid of reference of vectors and docIds from
NativeEngineFieldVectorsWriter
and just useFlatFieldVectorsWriter
during flush. This will simplify the code and will also free up some resources from heap.