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 <bzhangam@amazon.com>
  • Loading branch information
bzhangam authored and martin-gaievski committed Jan 10, 2025
1 parent 8086520 commit 931dbe8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,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 @@ -317,7 +317,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 931dbe8

Please sign in to comment.