Skip to content

Commit 73334ad

Browse files
authored
Use expectedDocs instead of actualDocs to stop posting lists iteration (#133116)
Stop iterating if we reached the expected docs so we don't over score in case of filtering.
1 parent bcfd399 commit 73334ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public final void search(String field, float[] target, KnnCollector knnCollector
251251
// TODO do we need to handle nested doc counts similarly to how we handle
252252
// filtering? E.g. keep exploring until we hit an expected number of parent documents vs. child vectors?
253253
while (centroidIterator.hasNext()
254-
&& (maxVectorVisited > actualDocs || knnCollector.minCompetitiveSimilarity() == Float.NEGATIVE_INFINITY)) {
254+
&& (maxVectorVisited > expectedDocs || knnCollector.minCompetitiveSimilarity() == Float.NEGATIVE_INFINITY)) {
255255
// todo do we actually need to know the score???
256256
long offset = centroidIterator.nextPostingListOffset();
257257
// todo do we need direct access to the raw centroid???, this is used for quantizing, maybe hydrating and quantizing

0 commit comments

Comments
 (0)