From f41e06285e8ab3712989f4f87ff1ef0cf8bc51ea Mon Sep 17 00:00:00 2001 From: Mouaad Aallam Date: Thu, 6 Jan 2022 13:53:09 +0100 Subject: [PATCH] feat: add 'enableReRanking' query parameter (#764) --- .../search/models/indexing/SearchParameters.java | 10 ++++++++++ .../java/com/algolia/search/JacksonParserTest.java | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/algoliasearch-core/src/main/java/com/algolia/search/models/indexing/SearchParameters.java b/algoliasearch-core/src/main/java/com/algolia/search/models/indexing/SearchParameters.java index 66acdd87a..0821fa2ad 100644 --- a/algoliasearch-core/src/main/java/com/algolia/search/models/indexing/SearchParameters.java +++ b/algoliasearch-core/src/main/java/com/algolia/search/models/indexing/SearchParameters.java @@ -676,6 +676,15 @@ public T setRelevancyStrictness(Integer relevancyStrictness) { return getThis(); } + public Boolean getEnableReRanking() { + return enableReRanking; + } + + public T setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + return getThis(); + } + public String toParam() { return QueryStringUtils.buildQueryAsQueryParams(this); } @@ -709,6 +718,7 @@ public String toParam() { protected Boolean percentileComputation; protected List queryLanguages; protected Boolean decompoundQuery; + protected Boolean enableReRanking; /* attributes */ protected List attributesToRetrieve; diff --git a/algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java b/algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java index 3183998b0..683a90682 100644 --- a/algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java +++ b/algoliasearch-core/src/test/java/com/algolia/search/JacksonParserTest.java @@ -670,6 +670,12 @@ void queryWithDistinct() { assertThat(query.toParam()).isEqualTo("query=&distinct=0"); } + @Test + void queryWitEnabledReRanking() { + Query query = new Query("").setEnableReRanking(false); + assertThat(query.toParam()).isEqualTo("enableReRanking=false&query="); + } + @Test void queryWithMultipleParams() { Query query =