Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix random total hits range for ExplanationPayloadProcessorTests. #1034

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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 @@ -125,7 +125,7 @@ public void testParsingOfExplanations_whenFieldSortingAndExplanations_thenSucces
searchHit.explanation(explanation);
}
TotalHits.Relation totalHitsRelation = randomFrom(TotalHits.Relation.values());
TotalHits totalHits = new TotalHits(randomLongBetween(0, 1000), totalHitsRelation);
TotalHits totalHits = new TotalHits(randomLongBetween(1, 1000), totalHitsRelation);
final SortField[] sortFields = new SortField[] {
new SortField("random-text-field-1", SortField.Type.INT, randomBoolean()),
new SortField("random-text-field-2", SortField.Type.STRING, randomBoolean()) };
Expand Down Expand Up @@ -203,7 +203,7 @@ private static SearchHits getSearchHits(float maxScore) {
int requestedSize = 2;
PriorityQueue<SearchHit> priorityQueue = new PriorityQueue<>(new SearchHitComparator(null));
TotalHits.Relation totalHitsRelation = randomFrom(TotalHits.Relation.values());
TotalHits totalHits = new TotalHits(randomLongBetween(0, 1000), totalHitsRelation);
TotalHits totalHits = new TotalHits(randomLongBetween(1, 1000), totalHitsRelation);

final int numDocs = totalHits.value >= requestedSize ? requestedSize : (int) totalHits.value;
int scoreFactor = randomIntBetween(1, numResponses);
Expand Down
Loading