Fix random failures in TestPerFieldVectorFormat#testMergeUsesNewFormat

This commit is contained in:
Julie Tibshirani 2021-06-08 12:52:16 -07:00
parent 300589433f
commit d22af75686
1 changed files with 3 additions and 0 deletions

View File

@ -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();