Skip to content

Commit

Permalink
Lint again
Browse files Browse the repository at this point in the history
  • Loading branch information
afoucret committed May 27, 2024
1 parent 1481e97 commit 460aeba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ public void testRescoreChainValidation() {
assertThat(
validationErrors.validationErrors().get(0),
equalTo(
"unable to add a rescorer with [window_size: 60] because a rescorer of type [not_combinable] with a smaller [window_size: 50] has been added before"
"unable to add a rescorer with [window_size: 60] because a rescorer of type [not_combinable] "
+ "with a smaller [window_size: 50] has been added before"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,10 @@ public void testLearningToRankRescoreSmallWindow() throws Exception {
Exception e = assertThrows(ResponseException.class, () -> client().performRequest(request));
assertThat(
e.getMessage(),
containsString( "rescorer [window_size] is too small and should be at least the value of [from + size: 4] but was [2]")
containsString("rescorer [window_size] is too small and should be at least the value of [from + size: 4] but was [2]")
);
}



public void testLearningToRankRescorerWithChainedRescorers() throws IOException {

String queryTemplate = """
Expand All @@ -262,7 +260,7 @@ public void testLearningToRankRescorerWithChainedRescorers() throws IOException
"query": { "rescore_query" : { "script_score": { "query": { "match_all": {} }, "script": { "source": "return 4" } } } }
},
{
"window_size": 4,
"window_size": 5,
"learning_to_rank": { "model_id": "ltr-model" }
},
{
Expand All @@ -272,15 +270,14 @@ public void testLearningToRankRescorerWithChainedRescorers() throws IOException
]
}""";


{
Request request = new Request("GET", "store/_search?size=4");
request.setJsonEntity(String.format(queryTemplate, randomIntBetween(2, 10000), randomIntBetween(2, 4)));
request.setJsonEntity(String.format(queryTemplate, randomIntBetween(2, 10000), randomIntBetween(4, 5)));
assertHitScores(client().performRequest(request), List.of(40.0, 40.0, 37.0, 29.0));
}

{
int lastRescorerWindowSize = randomIntBetween(5, 10000);
int lastRescorerWindowSize = randomIntBetween(6, 10000);
Request request = new Request("GET", "store/_search?size=4");
request.setJsonEntity(String.format(queryTemplate, randomIntBetween(2, 10000), lastRescorerWindowSize));

Expand All @@ -289,9 +286,9 @@ public void testLearningToRankRescorerWithChainedRescorers() throws IOException
e.getMessage(),
containsString(
"unable to add a rescorer with [window_size: "
+ lastRescorerWindowSize
+ "] because a rescorer of type [learning_to_rank]"
+" with a smaller [window_size: 4] has been added before"
+ lastRescorerWindowSize
+ "] because a rescorer of type [learning_to_rank]"
+ " with a smaller [window_size: 5] has been added before"
)
);
}
Expand Down

0 comments on commit 460aeba

Please sign in to comment.