Skip to content

Commit

Permalink
randomize the query range
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Jan 27, 2025
1 parent 5beb5c0 commit 446adfa
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,16 @@ public boolean shouldCache(Query query) {
return false;
}
});
prq = LongPoint.newRangeQuery("number", 0, docCount);
dvq = SortedNumericDocValuesField.newSlowRangeQuery("number", 0, docCount);

long[] range = new long[]{0, docCount};
long random = (long)(Math.random() * docCount);
if (random < docCount / 2) {
range[0] = random;
} else {
range[1] = random;
}
prq = LongPoint.newRangeQuery("number", range[0], range[1]);
dvq = SortedNumericDocValuesField.newSlowRangeQuery("number", range[0], range[1]);
}

@TearDown
Expand Down

0 comments on commit 446adfa

Please sign in to comment.