Skip to content

Apache Lucene open-source search software

Fix test failure

Adrien Grandcc3b412183c7
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
index ed776b371c2..0432f05d94f 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java
@@ -154,7 +154,9 @@ public class TestIndexSorting extends LuceneTestCase {
Sort indexSort = new Sort(sortField, new SortField("id", SortField.Type.INT));
iwc.setIndexSort(indexSort);
LogMergePolicy policy = newLogMergePolicy();
- // make sure that merge factor is always > 2
+ // make sure that merge factor is always > 2 and target search concurrency is no more than 1 to
+ // avoid creating merges that are accidentally sorted
+ policy.setTargetSearchConcurrency(1);
if (policy.getMergeFactor() <= 2) {
policy.setMergeFactor(3);
}