From b33ff16d62e57843c407271d3aadeb6328567441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Thu, 13 Dec 2018 20:13:16 +0100 Subject: [PATCH] Remove deprecated `useDisMax` from MultiMatchQuery (#36488) The getters and setters for useDisMax() have been deprecated since at least 6.0, also there hasn't been any reference to the query parameter in the documentation. Removing it from the builder and tests and replacing it with `tieBreaker(1.0f)` where necessary. --- .../index/query/MultiMatchQueryBuilder.java | 43 +++---------------- .../query/MultiMatchQueryBuilderTests.java | 14 +++--- .../search/query/MultiMatchQueryIT.java | 12 +++--- .../search/query/SearchQueryIT.java | 7 +-- .../qa/src/main/resources/fulltext.csv-spec | 4 +- .../sql/querydsl/query/MultiMatchQuery.java | 5 +-- .../querydsl/query/MultiMatchQueryTests.java | 3 +- 7 files changed, 25 insertions(+), 63 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java index 996e878dba8..d8476d791d7 100644 --- a/server/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java @@ -67,7 +67,6 @@ public class MultiMatchQueryBuilder extends AbstractQueryBuilderTie-Breaker for "best-match" disjunction queries (OR-Queries). * The tie breaker capability allows documents that match more than one query clause @@ -593,9 +581,6 @@ public class MultiMatchQueryBuilder extends AbstractQueryBuilder newFieldsBoosts; if (fieldsBoosts.isEmpty()) { // no fields provided, defaults to index.query.default_field @@ -828,7 +800,7 @@ public class MultiMatchQueryBuilder extends AbstractQueryBuilder qb.lenient(Booleans.parseBoolean(s))); appliers.put("cutoff_frequency", (qb, s) -> qb.cutoffFrequency(Float.valueOf(s))); appliers.put("tie_breaker", (qb, s) -> qb.tieBreaker(Float.valueOf(s))); - appliers.put("use_dis_max", (qb, s) -> qb.useDisMax(Booleans.parseBoolean(s))); appliers.put("fuzzy_rewrite", (qb, s) -> qb.fuzzyRewrite(s)); appliers.put("minimum_should_match", (qb, s) -> qb.minimumShouldMatch(s)); appliers.put("operator", (qb, s) -> qb.operator(Operator.fromString(s))); diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/querydsl/query/MultiMatchQueryTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/querydsl/query/MultiMatchQueryTests.java index ba2d548cde9..2e26c7c0595 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/querydsl/query/MultiMatchQueryTests.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/querydsl/query/MultiMatchQueryTests.java @@ -23,8 +23,7 @@ public class MultiMatchQueryTests extends ESTestCase { MultiMatchQueryBuilder qb = getBuilder("lenient=true"); assertThat(qb.lenient(), equalTo(true)); - qb = getBuilder("use_dis_max=true;type=best_fields"); - assertThat(qb.useDisMax(), equalTo(true)); + qb = getBuilder("type=best_fields"); assertThat(qb.getType(), equalTo(MultiMatchQueryBuilder.Type.BEST_FIELDS)); Exception e = expectThrows(IllegalArgumentException.class, () -> getBuilder("pizza=yummy"));