Skip to content

Commit

Permalink
Extend error message, fix typo in class name
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Gaievski <[email protected]>
  • Loading branch information
martin-gaievski committed Dec 29, 2023
1 parent 7d6dc4c commit 6e3264d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ private SearchHit[] getSearchHits(final List<Integer> docIds, final FetchSearchR
}
if (searchHitArray.length != docIds.size()) {
throw new IllegalStateException(
"score normalization processor cannot produce final query result, the number of documents returned by fetch and query phases does not match"
String.format(
Locale.ROOT,
"score normalization processor cannot produce final query result, the number of documents after fetch phase [%d] is different from number of documents from query phase [%d]",
searchHitArray.length,
docIds.size()
)
);
}
return searchHitArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import org.apache.lucene.search.ScoreMode;
import org.opensearch.neuralsearch.query.OpenSearchQueryTestCase;

public class HitsTresholdCheckerTests extends OpenSearchQueryTestCase {
public class HitsThresholdCheckerTests extends OpenSearchQueryTestCase {

public void testTresholdReached_whenIncrementCount_thenTresholdReached() {
public void testThresholdReached_whenIncrementCount_thenThresholdReached() {
HitsThresholdChecker hitsThresholdChecker = new HitsThresholdChecker(5);
assertEquals(5, hitsThresholdChecker.getTotalHitsThreshold());
assertEquals(ScoreMode.TOP_SCORES, hitsThresholdChecker.scoreMode());
Expand All @@ -23,7 +23,7 @@ public void testTresholdReached_whenIncrementCount_thenTresholdReached() {
assertTrue(hitsThresholdChecker.isThresholdReached());
}

public void testTresholdLimit_whenThresholdNegative_thenFail() {
public void testThresholdLimit_whenThresholdNegative_thenFail() {
expectThrows(IllegalArgumentException.class, () -> new HitsThresholdChecker(-1));
}

Expand Down

0 comments on commit 6e3264d

Please sign in to comment.