From 24f68b27b8be5051c8cd1e71c5f30f89cd9b1012 Mon Sep 17 00:00:00 2001 From: Bo Zhang Date: Wed, 18 Dec 2024 11:30:57 -0800 Subject: [PATCH] Fix random total hits range for ExplanationPayloadProcessorTests. Signed-off-by: Bo Zhang --- .../processor/ExplanationPayloadProcessorTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/opensearch/neuralsearch/processor/ExplanationPayloadProcessorTests.java b/src/test/java/org/opensearch/neuralsearch/processor/ExplanationPayloadProcessorTests.java index e47ea43d2..2e603d078 100644 --- a/src/test/java/org/opensearch/neuralsearch/processor/ExplanationPayloadProcessorTests.java +++ b/src/test/java/org/opensearch/neuralsearch/processor/ExplanationPayloadProcessorTests.java @@ -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()) }; @@ -203,7 +203,7 @@ private static SearchHits getSearchHits(float maxScore) { int requestedSize = 2; PriorityQueue 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);