LUCENE-9620: Fix test bug.

This commit is contained in:
Adrien Grand 2021-09-20 09:47:35 +02:00
parent 075d801abe
commit 4bcd64c5ed
2 changed files with 3 additions and 2 deletions

View File

@ -742,7 +742,7 @@ public class TestBooleanQuery extends LuceneTestCase {
Directory dir = newDirectory(); Directory dir = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), dir); RandomIndexWriter w = new RandomIndexWriter(random(), dir);
int randomNumDocs = random().nextInt(500); int randomNumDocs = TestUtil.nextInt(random(), 10, 100);
int numMatchingDocs = 0; int numMatchingDocs = 0;
for (int i = 0; i < randomNumDocs; i++) { for (int i = 0; i < randomNumDocs; i++) {

View File

@ -37,6 +37,7 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
public class TestTermQuery extends LuceneTestCase { public class TestTermQuery extends LuceneTestCase {
@ -108,7 +109,7 @@ public class TestTermQuery extends LuceneTestCase {
Directory dir = newDirectory(); Directory dir = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random(), dir); RandomIndexWriter w = new RandomIndexWriter(random(), dir);
int randomNumDocs = random().nextInt(500); int randomNumDocs = TestUtil.nextInt(random(), 10, 100);
int numMatchingDocs = 0; int numMatchingDocs = 0;
for (int i = 0; i < randomNumDocs; i++) { for (int i = 0; i < randomNumDocs; i++) {