From 4bcd64c5ed43872a6c523aaf239274742a3faa0c Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Mon, 20 Sep 2021 09:47:35 +0200 Subject: [PATCH] LUCENE-9620: Fix test bug. --- .../src/test/org/apache/lucene/search/TestBooleanQuery.java | 2 +- .../core/src/test/org/apache/lucene/search/TestTermQuery.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java index a24fac012e6..b287f0e8794 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java @@ -742,7 +742,7 @@ public class TestBooleanQuery extends LuceneTestCase { Directory dir = newDirectory(); RandomIndexWriter w = new RandomIndexWriter(random(), dir); - int randomNumDocs = random().nextInt(500); + int randomNumDocs = TestUtil.nextInt(random(), 10, 100); int numMatchingDocs = 0; for (int i = 0; i < randomNumDocs; i++) { diff --git a/lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java index 7a7542f35dc..5a35ff49ff7 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java @@ -37,6 +37,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.LuceneTestCase; +import org.apache.lucene.util.TestUtil; public class TestTermQuery extends LuceneTestCase { @@ -108,7 +109,7 @@ public class TestTermQuery extends LuceneTestCase { Directory dir = newDirectory(); RandomIndexWriter w = new RandomIndexWriter(random(), dir); - int randomNumDocs = random().nextInt(500); + int randomNumDocs = TestUtil.nextInt(random(), 10, 100); int numMatchingDocs = 0; for (int i = 0; i < randomNumDocs; i++) {