From 229dc7481ef7c3ca4cdcff65c8c10ef34a18835a Mon Sep 17 00:00:00 2001 From: Benjamin Trent Date: Wed, 2 Aug 2023 14:10:57 -0400 Subject: [PATCH] Fix randomly failing field info format tests (#12473) --- .../apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java index 7a054c290c3..b3bd9656171 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseFieldInfoFormatTestCase.java @@ -354,7 +354,7 @@ public abstract class BaseFieldInfoFormatTestCase extends BaseIndexFileFormatTes type.setDimensions(dimension, indexDimension, dimensionNumBytes); } - if (r.nextBoolean()) { + if (r.nextBoolean() && getVectorsMaxDimensions(fieldName) > 0) { int dimension = 1 + r.nextInt(getVectorsMaxDimensions(fieldName)); VectorSimilarityFunction similarityFunction = RandomPicks.randomFrom(r, VectorSimilarityFunction.values());