Skip to content

Commit 647c05b

Browse files
authored
Adds OffHeapQuantizedFloatVectorValues to access float vectors when only quantized vectors are present (#14792)
1 parent ff6c940 commit 647c05b

File tree

5 files changed

+553
-1
lines changed

5 files changed

+553
-1
lines changed

lucene/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ New Features
3232

3333
* GITHUB#14178: Add a Faiss-based vector format in the sandbox module. (Kaival Parikh)
3434

35+
* GITHUB#14792: Introduced OffHeapQuantizedFloatVectorValues class to access float vectors when only quantized byte vectors are available in the index. (Pulkit Gupta)
36+
3537
Improvements
3638
---------------------
3739

lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99ScalarQuantizedVectorsReader.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,20 @@ private FieldEntry getFieldEntry(String field) {
189189
public FloatVectorValues getFloatVectorValues(String field) throws IOException {
190190
final FieldEntry fieldEntry = getFieldEntry(field);
191191
final FloatVectorValues rawVectorValues = rawVectorsReader.getFloatVectorValues(field);
192+
if (rawVectorValues.size() == 0) {
193+
return OffHeapQuantizedFloatVectorValues.load(
194+
fieldEntry.ordToDoc,
195+
fieldEntry.dimension,
196+
fieldEntry.size,
197+
fieldEntry.scalarQuantizer,
198+
fieldEntry.similarityFunction,
199+
vectorScorer,
200+
fieldEntry.compress,
201+
fieldEntry.vectorDataOffset,
202+
fieldEntry.vectorDataLength,
203+
quantizedVectorData);
204+
}
205+
192206
OffHeapQuantizedByteVectorValues quantizedByteVectorValues =
193207
OffHeapQuantizedByteVectorValues.load(
194208
fieldEntry.ordToDoc,

0 commit comments

Comments
 (0)