Skip to content

Commit 5320838

Browse files
authored
[DiskBBQ] Fix Computation of DocsPerCentroid (elastic#138173)
This commit fixes the computation of docs per centroid added in elastic#138127.
1 parent 8115749 commit 5320838

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/diskbbq/next/ESNextDiskBBQVectorsReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public CentroidIterator getCentroidIterator(
123123
float approximateDocsPerCentroid = approximateCost / numCentroids;
124124
if (approximateDocsPerCentroid <= 1.25) {
125125
// TODO: we need to make this call to build the iterator, otherwise accept docs breaks all together
126-
approximateDocsPerCentroid = acceptDocs.cost();
126+
approximateDocsPerCentroid = (float) acceptDocs.cost() / numCentroids;
127127
}
128128
final int bitsRequired = DirectWriter.bitsRequired(numCentroids);
129129
final long sizeLookup = directWriterSizeOnDisk(values.size(), bitsRequired);

0 commit comments

Comments
 (0)