Skip to content

Commit

Permalink
Added more details to exception message, removed log for case of inco…
Browse files Browse the repository at this point in the history
…nsistent shard results

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
  • Loading branch information
martin-gaievski committed Aug 29, 2023
1 parent d33370e commit a593a7a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,28 @@ private List<CompoundTopDocs> getQueryTopDocs(final List<QuerySearchResult> quer
.map(CompoundTopDocs::new)
.collect(Collectors.toList());
if (queryTopDocs.size() != querySearchResults.size()) {
log.error(
throw new IllegalStateException(
String.format(

Check warning on line 86 in src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java#L85-L86

Added lines #L85 - L86 were not covered by tests
Locale.ROOT,
"sizes of querySearchResults [%d] and queryTopDocs [%d] must match. Most likely some of query results were not formatted correctly by the hybrid query",
"query results were not formatted correctly by the hybrid query; sizes of querySearchResults [%d] and queryTopDocs [%d] must match",
querySearchResults.size(),
queryTopDocs.size()

Check warning on line 90 in src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java#L89-L90

Added lines #L89 - L90 were not covered by tests
)
);
throw new IllegalStateException("found inconsistent system state while processing score normalization and combination");
}
return queryTopDocs;
}

private void updateOriginalQueryResults(final List<QuerySearchResult> querySearchResults, final List<CompoundTopDocs> queryTopDocs) {
if (querySearchResults.size() != queryTopDocs.size()) {
log.error(
throw new IllegalStateException(
String.format(

Check warning on line 100 in src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java#L99-L100

Added lines #L99 - L100 were not covered by tests
Locale.ROOT,
"sizes of querySearchResults [%d] and queryTopDocs [%d] must match",
"query results were not formatted correctly by the hybrid query; sizes of querySearchResults [%d] and queryTopDocs [%d] must match",
querySearchResults.size(),
queryTopDocs.size()

Check warning on line 104 in src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/neuralsearch/processor/NormalizationProcessorWorkflow.java#L103-L104

Added lines #L103 - L104 were not covered by tests
)
);
throw new IllegalStateException("found inconsistent system state while processing score normalization and combination");
}
for (int index = 0; index < querySearchResults.size(); index++) {
QuerySearchResult querySearchResult = querySearchResults.get(index);
Expand Down

0 comments on commit a593a7a

Please sign in to comment.