Fix test failure TestDocumentsImpl.testGetDocumentFields (#13303)

This commit is contained in:
Zhang Chao 2024-04-15 21:56:51 +08:00 committed by GitHub
parent 1c3c094227
commit dca87235be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package org.apache.lucene.luke.models.documents;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Random;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@ -53,7 +54,13 @@ public abstract class DocumentsTestBase extends LuceneTestCase {
indexDir = createTempDir();
Directory dir = newFSDirectory(indexDir);
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, new StandardAnalyzer());
Random r = random();
RandomIndexWriter writer =
new RandomIndexWriter(
r,
dir,
newIndexWriterConfig(r, new StandardAnalyzer())
.setMergePolicy(newMergePolicy(r, false)));
FieldType titleType = new FieldType();
titleType.setIndexOptions(IndexOptions.DOCS_AND_FREQS);