You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ji...@apache.org on 2026/09/28 07:47:36 UTC
(lucene) branch branch_10x updated: Say how the staged query vectors are read (#16682)
This is an automated email from the ASF dual-hosted git repository.
jimczi pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new bfbbd514931 Say how the staged query vectors are read (#16682)
bfbbd514931 is described below
commit bfbbd5149316a2f67ac851ff2130cbd6300a76fa
Author: Jim Ferenczi <ji...@elastic.co>
AuthorDate: Mon Sep 28 09:42:27 2026 +0200
Say how the staged query vectors are read (#16682)
The quantized query vectors a merge stages for the graph build were
created and read back with the merge context, so they resolved to
sequential advice while the graph build reads them by ordinal. Main sets
the hints in the writer, which is where the staging lives there.
---
.../lucene104/Lucene104ScalarQuantizedVectorsReader.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java
index 0b14d030097..2a7ed807aeb 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java
@@ -47,6 +47,7 @@ import org.apache.lucene.search.AcceptDocs;
import org.apache.lucene.search.KnnCollector;
import org.apache.lucene.search.VectorScorer;
import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataAccessHint;
import org.apache.lucene.store.FileDataHint;
import org.apache.lucene.store.FileTypeHint;
import org.apache.lucene.store.IOContext;
@@ -453,6 +454,15 @@ public class Lucene104ScalarQuantizedVectorsReader extends FlatVectorsReader
return null;
}
+ /**
+ * The quantized query vectors staged for the merge scorer. A graph build reads them by ordinal as
+ * it walks, so they are read at random.
+ */
+ private static IOContext queryDataContext(SegmentWriteState segmentWriteState) {
+ return segmentWriteState.context.withHints(
+ FileTypeHint.DATA, FileDataHint.KNN_VECTORS, DataAccessHint.RANDOM);
+ }
+
@Override
public CloseableRandomVectorScorerSupplier getRandomVectorScorerSupplierForMerge(
FieldInfo fieldInfo, SegmentWriteState segmentWriteState) throws IOException {
@@ -479,7 +489,7 @@ public class Lucene104ScalarQuantizedVectorsReader extends FlatVectorsReader
DocsWithFieldSet docsWithField;
try (IndexOutput tempScoreQuantizedVector =
segmentWriteState.directory.createTempOutput(
- segmentWriteState.segmentInfo.name, "queries", segmentWriteState.context)) {
+ segmentWriteState.segmentInfo.name, "queries", queryDataContext(segmentWriteState))) {
tempScoreQuantizedVectorName = tempScoreQuantizedVector.getName();
docsWithField =
writeBinarizedQueryData(
@@ -498,7 +508,7 @@ public class Lucene104ScalarQuantizedVectorsReader extends FlatVectorsReader
}
IndexInput quantizedScoreDataInput =
segmentWriteState.directory.openInput(
- tempScoreQuantizedVectorName, segmentWriteState.context);
+ tempScoreQuantizedVectorName, queryDataContext(segmentWriteState));
try {
OffHeapScalarQuantizedVectorValues scoreVectorValues =
new OffHeapScalarQuantizedVectorValues.DenseOffHeapVectorValues(