Skip to content

Commit

Permalink
Fix random total hits range for ExplanationPayloadProcessorTests. (#1034
Browse files Browse the repository at this point in the history
)

Signed-off-by: Bo Zhang <[email protected]>
  • Loading branch information
bzhangam authored Dec 18, 2024
1 parent a759207 commit 22ba5d3
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 22ba5d3

Please sign in to comment.