Skip to content

Commit

Permalink
Add no merge policy in test to avoid index merge (#12643)
Browse files Browse the repository at this point in the history
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
  • Loading branch information
sandeshkr419 authored Mar 13, 2024
1 parent 77a1193 commit e1c1858
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.NoMergePolicy;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.DocValuesFieldExistsQuery;
import org.apache.lucene.search.IndexSearcher;
Expand Down Expand Up @@ -345,7 +346,13 @@ private void testSimple(
final int expectedCollectCount
) throws Exception {
try (Directory directory = newDirectory()) {
try (RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory)) {
try (
RandomIndexWriter indexWriter = new RandomIndexWriter(
random(),
directory,
newIndexWriterConfig().setMergePolicy(NoMergePolicy.INSTANCE)
)
) {
Document document = new Document();
addFieldConsumer.apply(document, "string", "a");
addFieldConsumer.apply(document, "string", "b");
Expand Down

0 comments on commit e1c1858

Please sign in to comment.