Skip to content

Commit 7dd338e

Browse files
committed
iter
1 parent 1ad6b22 commit 7dd338e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,9 @@
4141
public class DefaultIVFVectorsReader extends IVFVectorsReader implements OffHeapStats {
4242

4343
// How many extra centroids we need to collect for each visited centroid for hierarchical centroids.
44-
public final float centroidOversampling;
4544

46-
public DefaultIVFVectorsReader(SegmentReadState state, FlatVectorsReader rawVectorsReader, int centroidsPerParentCluster)
47-
throws IOException {
45+
public DefaultIVFVectorsReader(SegmentReadState state, FlatVectorsReader rawVectorsReader) throws IOException {
4846
super(state, rawVectorsReader);
49-
centroidOversampling = (float) centroidsPerParentCluster / 2;
5047
}
5148

5249
CentroidIterator getPostingListPrefetchIterator(CentroidIterator centroidIterator, IndexInput postingListSlice) throws IOException {
@@ -115,8 +112,11 @@ CentroidIterator getCentroidIterator(
115112
final ES92Int7VectorsScorer scorer = ESVectorUtil.getES92Int7VectorsScorer(centroids, fieldInfo.getVectorDimension());
116113
centroids.seek(0L);
117114
int numParents = centroids.readVInt();
115+
118116
CentroidIterator centroidIterator;
119117
if (numParents > 0) {
118+
// equivalent to (float) centroidsPerParentCluster / 2
119+
float centroidOversampling = (float) fieldEntry.numCentroids() / (2 * numParents);
120120
centroidIterator = getCentroidIteratorWithParents(
121121
fieldInfo,
122122
centroids,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public KnnVectorsWriter fieldsWriter(SegmentWriteState state) throws IOException
110110

111111
@Override
112112
public KnnVectorsReader fieldsReader(SegmentReadState state) throws IOException {
113-
return new DefaultIVFVectorsReader(state, rawVectorFormat.fieldsReader(state), centroidsPerParentCluster);
113+
return new DefaultIVFVectorsReader(state, rawVectorFormat.fieldsReader(state));
114114
}
115115

116116
@Override

0 commit comments

Comments
 (0)