Skip to content

Commit 14848f8

Browse files
committed
adding check for vectors per cluster
1 parent 5d3df96 commit 14848f8

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat;
1919
import org.apache.lucene.index.SegmentReadState;
2020
import org.apache.lucene.index.SegmentWriteState;
21-
import org.elasticsearch.common.util.FeatureFlag;
2221

2322
import java.io.IOException;
2423

@@ -46,7 +45,6 @@
4645
*/
4746
public class IVFVectorsFormat extends KnnVectorsFormat {
4847

49-
static final FeatureFlag IVF_FORMAT_FEATURE_FLAG = new FeatureFlag("ivf_format");
5048
public static final String IVF_VECTOR_COMPONENT = "IVF";
5149
public static final String NAME = "IVFVectorsFormat";
5250
// centroid ordinals -> centroid values, offsets
@@ -69,18 +67,15 @@ public class IVFVectorsFormat extends KnnVectorsFormat {
6967

7068
public IVFVectorsFormat(int vectorPerCluster) {
7169
super(NAME);
72-
if (IVF_FORMAT_FEATURE_FLAG.isEnabled() == false) {
73-
throw new IllegalStateException("IVF format is not enabled");
70+
if (vectorPerCluster <= 0) {
71+
throw new IllegalArgumentException("vectorPerCluster must be > 0");
7472
}
7573
this.vectorPerCluster = vectorPerCluster;
7674
}
7775

7876
/** Constructs a format using the given graph construction parameters and scalar quantization. */
7977
public IVFVectorsFormat() {
8078
this(DEFAULT_VECTORS_PER_CLUSTER);
81-
if (IVF_FORMAT_FEATURE_FLAG.isEnabled() == false) {
82-
throw new IllegalStateException("IVF format is not enabled");
83-
}
8479
}
8580

8681
@Override

server/src/test/java/org/elasticsearch/index/codec/vectors/IVFVectorsFormatTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public void testSearchWithVisitedLimit() {
6060

6161
@Override
6262
protected Codec getCodec() {
63-
assumeTrue("IVF format flat enabled", IVFVectorsFormat.IVF_FORMAT_FEATURE_FLAG.isEnabled());
6463
return TestUtil.alwaysKnnVectorsFormat(format);
6564
}
6665
}

0 commit comments

Comments
 (0)