From 460aeba89496788e15bae596ec81fd39f0505831 Mon Sep 17 00:00:00 2001 From: Aurelien FOUCRET Date: Mon, 27 May 2024 16:29:02 +0200 Subject: [PATCH] Lint again --- .../action/search/SearchRequestTests.java | 3 ++- .../integration/LearningToRankRescorerIT.java | 17 +++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/action/search/SearchRequestTests.java b/server/src/test/java/org/elasticsearch/action/search/SearchRequestTests.java index db2596c89faae..228ddd446943c 100644 --- a/server/src/test/java/org/elasticsearch/action/search/SearchRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/search/SearchRequestTests.java @@ -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" ) ); } diff --git a/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java index b21e04b721e25..3c4e2f05d9340 100644 --- a/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java +++ b/x-pack/plugin/ml/qa/single-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/LearningToRankRescorerIT.java @@ -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 = """ @@ -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" } }, { @@ -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)); @@ -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" ) ); }