Skip to content

Commit

Permalink
Fix few failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
afoucret committed May 30, 2024
1 parent 2dc4e4d commit a5181da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ public ActionRequestValidationException validate(SearchRequest searchRequest, Ac
if (windowSize() < nextRescorerWindowSize) {
return addValidationError(
"unable to add a rescorer with [window_size: "
+ nextRescorer.windowSize()
+ nextRescorerWindowSize
+ "] because a rescorer of type ["
+ nextRescorer.getWriteableName()
+ getWriteableName()
+ "] with a smaller [window_size: "
+ windowSize()
+ "] has been added before",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,29 +133,27 @@ public void testRescoreChainValidation() {
assertThat(
validationErrors.validationErrors().get(0),
equalTo(
"unable to add a rescorer with [window_size: 60] because a rescorer of type [query] "
"unable to add a rescorer with [window_size: 60] because a rescorer of type [learning_to_rank] "
+ "with a smaller [window_size: 50] has been added before"
)
);
}

{
SearchSourceBuilder source = new SearchSourceBuilder().from(10)
.size(10)
SearchSourceBuilder source = new SearchSourceBuilder().size(3)
.addRescorer(createQueryRescorerBuilder(randomIntBetween(2, 10000)))
.addRescorer(createQueryRescorerBuilder(randomIntBetween(2, 10000)))
.addRescorer(createTestInstance(50))
.addRescorer(createTestInstance(5))
.addRescorer(createQueryRescorerBuilder(null));

int windowSize = source.rescores().get(3).windowSize();
SearchRequest searchRequest = new SearchRequest().source(source);
ActionRequestValidationException validationErrors = searchRequest.validate();
assertNotNull(validationErrors);
assertThat(
validationErrors.validationErrors().get(0),
equalTo(
"unable to add a rescorer with [window_size: 10] because a rescorer of type [query] "
+ "with a smaller [window_size: 50] has been added before"
"unable to add a rescorer with [window_size: 10] because a rescorer of type [learning_to_rank] "
+ "with a smaller [window_size: 5] has been added before"
)
);
}
Expand Down

0 comments on commit a5181da

Please sign in to comment.