Skip to content

Commit

Permalink
Add no merge policy in test to avoid index merge (opensearch-project#…
Browse files Browse the repository at this point in the history
…12643)

Signed-off-by: Sandesh Kumar <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
sandeshkr419 authored and shiv0408 committed Apr 25, 2024
1 parent a85796d commit d616694
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 d616694

Please sign in to comment.