From d22af75686121c6136a747eb8e3a1d4667d02f46 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 8 Jun 2021 12:52:16 -0700 Subject: [PATCH] Fix random failures in TestPerFieldVectorFormat#testMergeUsesNewFormat --- .../lucene/codecs/perfield/TestPerFieldVectorFormat.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldVectorFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldVectorFormat.java index 63210b04227..0c3fe5fe253 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldVectorFormat.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/perfield/TestPerFieldVectorFormat.java @@ -38,6 +38,7 @@ import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.NoMergePolicy; import org.apache.lucene.index.RandomCodec; import org.apache.lucene.index.SegmentReadState; import org.apache.lucene.index.SegmentWriteState; @@ -121,6 +122,8 @@ public class TestPerFieldVectorFormat extends BaseVectorFormatTestCase { public void testMergeUsesNewFormat() throws IOException { try (Directory directory = newDirectory()) { IndexWriterConfig initialConfig = newIndexWriterConfig(new MockAnalyzer(random())); + initialConfig.setMergePolicy(NoMergePolicy.INSTANCE); + try (IndexWriter iw = new IndexWriter(directory, initialConfig)) { for (int i = 0; i < 3; i++) { Document doc = new Document();