Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,6 @@ private FieldEntry getFieldEntry(String field) {
public FloatVectorValues getFloatVectorValues(String field) throws IOException {
final FieldEntry fieldEntry = getFieldEntry(field);
final FloatVectorValues rawVectorValues = rawVectorsReader.getFloatVectorValues(field);
if (rawVectorValues.size() == 0) {
return OffHeapQuantizedFloatVectorValues.load(
fieldEntry.ordToDoc,
fieldEntry.dimension,
fieldEntry.size,
fieldEntry.scalarQuantizer,
fieldEntry.similarityFunction,
vectorScorer,
fieldEntry.compress,
fieldEntry.vectorDataOffset,
fieldEntry.vectorDataLength,
quantizedVectorData);
}

OffHeapQuantizedByteVectorValues quantizedByteVectorValues =
OffHeapQuantizedByteVectorValues.load(
Expand All @@ -220,6 +207,27 @@ public FloatVectorValues getFloatVectorValues(String field) throws IOException {
fieldEntry.vectorDataOffset,
fieldEntry.vectorDataLength,
quantizedVectorData);

if (rawVectorValues.size() == 0) {
// Full-precision vectors were dropped. Wrap the dequantizing read view with the quantized
// values so scorer() stays quantized (as in the full-precision branch) while
// vectorValue()/rescorer() dequantize. Passing the dequantized view straight to a scorer
// would misroute to the non-quantized flat scorer over the quantized slice.
FloatVectorValues dequantizedRawVectorValues =
OffHeapQuantizedFloatVectorValues.load(
fieldEntry.ordToDoc,
fieldEntry.dimension,
fieldEntry.size,
fieldEntry.scalarQuantizer,
fieldEntry.similarityFunction,
vectorScorer,
fieldEntry.compress,
fieldEntry.vectorDataOffset,
fieldEntry.vectorDataLength,
quantizedVectorData);
return new QuantizedVectorValues(dequantizedRawVectorValues, quantizedByteVectorValues);
}

return new QuantizedVectorValues(rawVectorValues, quantizedByteVectorValues);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,6 @@ public FloatVectorValues getFloatVectorValues(String field) throws IOException {

FloatVectorValues rawFloatVectorValues = rawVectorsReader.getFloatVectorValues(field);

if (rawFloatVectorValues.size() == 0) {
return OffHeapScalarQuantizedFloatVectorValues.load(
fi.ordToDocDISIReaderConfiguration,
fi.dimension,
fi.size,
fi.scalarEncoding,
fi.similarityFunction,
vectorScorer,
fi.centroid,
fi.vectorDataOffset,
fi.vectorDataLength,
quantizedVectorData);
}

OffHeapScalarQuantizedVectorValues sqvv =
OffHeapScalarQuantizedVectorValues.load(
fi.ordToDocDISIReaderConfiguration,
Expand All @@ -273,6 +259,28 @@ public FloatVectorValues getFloatVectorValues(String field) throws IOException {
fi.vectorDataOffset,
fi.vectorDataLength,
quantizedVectorData);

if (rawFloatVectorValues.size() == 0) {
// Full-precision vectors were dropped. Wrap the dequantizing read view with sqvv so scorer()
// stays quantized (as in the full-precision branch) while vectorValue()/rescorer()
// dequantize.
// Passing the dequantized view straight to a scorer would misroute to the non-quantized flat
// scorer over the quantized slice.
FloatVectorValues dequantizedRawVectorValues =
OffHeapScalarQuantizedFloatVectorValues.load(
fi.ordToDocDISIReaderConfiguration,
fi.dimension,
fi.size,
fi.scalarEncoding,
fi.similarityFunction,
vectorScorer,
fi.centroid,
fi.vectorDataOffset,
fi.vectorDataLength,
quantizedVectorData);
return new ScalarQuantizedVectorValues(dequantizedRawVectorValues, sqvv);
}

return new ScalarQuantizedVectorValues(rawFloatVectorValues, sqvv);
}

Expand Down
Loading