Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,23 @@ public void testAllDocsInFieldTerm() throws IOException {
public void testDuel() throws IOException {
final int iters = atLeast(2);
final String field = "f";
final int maxTerms = 256;
for (int iter = 0; iter < iters; ++iter) {
final List<BytesRef> allTerms = new ArrayList<>();
final int numTerms = TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 10));
// final int numTerms = TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 10));
final int numTerms = Math.min(
TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 10)),
maxTerms
);
Comment on lines +118 to +122
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reuse RandomizedTest.randomIntBetween(...) instead of this code.

for (int i = 0; i < numTerms; ++i) {
final String value = TestUtil.randomAnalysisString(random(), 10, true);
allTerms.add(newBytesRef(value));
}
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
final int numDocs = atLeast(10_000);
// final int numDocs = atLeast(10_000);
final int maxDocs = 20000;
final int numDocs = Math.min(atLeast(10_000), maxDocs);
for (int i = 0; i < numDocs; ++i) {
Document doc = new Document();
final BytesRef term = allTerms.get(random().nextInt(allTerms.size()));
Expand All @@ -148,7 +155,11 @@ public void testDuel() throws IOException {
for (int i = 0; i < 100; ++i) {
final float boost = random().nextFloat() * 10;
final int numQueryTerms =
TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 8));
// TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 8));
Math.min(
TestUtil.nextInt(random(), 1, 1 << TestUtil.nextInt(random(), 1, 8)),
256
);
List<BytesRef> queryTerms = new ArrayList<>();
for (int j = 0; j < numQueryTerms; ++j) {
queryTerms.add(allTerms.get(random().nextInt(allTerms.size())));
Expand Down
Loading