Explorar o código

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.
Ignacio Vera hai 1 mes
pai
achega
73334add31

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

@@ -251,7 +251,7 @@ public abstract class IVFVectorsReader extends KnnVectorsReader {
         // TODO do we need to handle nested doc counts similarly to how we handle
         // filtering? E.g. keep exploring until we hit an expected number of parent documents vs. child vectors?
         while (centroidIterator.hasNext()
-            && (maxVectorVisited > actualDocs || knnCollector.minCompetitiveSimilarity() == Float.NEGATIVE_INFINITY)) {
+            && (maxVectorVisited > expectedDocs || knnCollector.minCompetitiveSimilarity() == Float.NEGATIVE_INFINITY)) {
             // todo do we actually need to know the score???
             long offset = centroidIterator.nextPostingListOffset();
             // todo do we need direct access to the raw centroid???, this is used for quantizing, maybe hydrating and quantizing