Remove remains of 'auto_generate_phrase_queries' (#35735)

This parameter in the `query_string` query was deprecated in 6.0 and ignored
since then. Its API methods and remaining uses can be removed in the upcoming
major version.

Relates to #35734
This commit is contained in:
Christoph Büscher 2018-11-20 16:07:17 +01:00 committed by GitHub
parent d061b3999a
commit e91f404d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 24 deletions

View File

@ -387,22 +387,6 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue
return this; return this;
} }
/**
* This setting is ignored
*/
@Deprecated
public QueryStringQueryBuilder autoGeneratePhraseQueries(boolean autoGeneratePhraseQueries) {
return this;
}
/**
* This setting is ignored
*/
@Deprecated
public boolean autoGeneratePhraseQueries() {
return false;
}
/** /**
* Protects against too-difficult regular expression queries. * Protects against too-difficult regular expression queries.
*/ */

View File

@ -127,9 +127,6 @@ public class QueryStringQueryBuilderTests extends AbstractQueryTestCase<QueryStr
if (randomBoolean()) { if (randomBoolean()) {
queryStringQueryBuilder.maxDeterminizedStates(randomIntBetween(1, 100)); queryStringQueryBuilder.maxDeterminizedStates(randomIntBetween(1, 100));
} }
if (randomBoolean()) {
queryStringQueryBuilder.autoGeneratePhraseQueries(randomBoolean());
}
if (randomBoolean()) { if (randomBoolean()) {
queryStringQueryBuilder.enablePositionIncrements(randomBoolean()); queryStringQueryBuilder.enablePositionIncrements(randomBoolean());
} }

View File

@ -19,6 +19,7 @@
package org.elasticsearch.search.fetch.subphase.highlight; package org.elasticsearch.search.fetch.subphase.highlight;
import com.carrotsearch.randomizedtesting.generators.RandomPicks; import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.analysis.MockTokenizer;
@ -2589,22 +2590,22 @@ public class HighlighterSearchIT extends ESIntegTestCase {
// Query string with a single field // Query string with a single field
phraseBoostTestCaseForClauses(highlighterType, 100f, phraseBoostTestCaseForClauses(highlighterType, 100f,
queryStringQuery("highlight words together").field("field1"), queryStringQuery("highlight words together").field("field1"),
queryStringQuery("\"highlight words together\"").field("field1").autoGeneratePhraseQueries(true)); queryStringQuery("\"highlight words together\"").field("field1"));
// Query string with a single field without dismax // Query string with a single field without dismax
phraseBoostTestCaseForClauses(highlighterType, 100f, phraseBoostTestCaseForClauses(highlighterType, 100f,
queryStringQuery("highlight words together").field("field1"), queryStringQuery("highlight words together").field("field1"),
queryStringQuery("\"highlight words together\"").field("field1").autoGeneratePhraseQueries(true)); queryStringQuery("\"highlight words together\"").field("field1"));
// Query string with more than one field // Query string with more than one field
phraseBoostTestCaseForClauses(highlighterType, 100f, phraseBoostTestCaseForClauses(highlighterType, 100f,
queryStringQuery("highlight words together").field("field1").field("field2"), queryStringQuery("highlight words together").field("field1").field("field2"),
queryStringQuery("\"highlight words together\"").field("field1").field("field2").autoGeneratePhraseQueries(true)); queryStringQuery("\"highlight words together\"").field("field1").field("field2"));
// Query string boosting the field // Query string boosting the field
phraseBoostTestCaseForClauses(highlighterType, 1f, phraseBoostTestCaseForClauses(highlighterType, 1f,
queryStringQuery("highlight words together").field("field1"), queryStringQuery("highlight words together").field("field1"),
queryStringQuery("\"highlight words together\"").field("field1", 100).autoGeneratePhraseQueries(true)); queryStringQuery("\"highlight words together\"").field("field1", 100));
} }
private <P extends AbstractQueryBuilder<P>> void private <P extends AbstractQueryBuilder<P>> void

View File

@ -33,7 +33,6 @@ public class QueryStringQuery extends LeafQuery {
appliers.put("analyzer", (qb, s) -> qb.analyzer(s)); appliers.put("analyzer", (qb, s) -> qb.analyzer(s));
appliers.put("quote_analyzer", (qb, s) -> qb.quoteAnalyzer(s)); appliers.put("quote_analyzer", (qb, s) -> qb.quoteAnalyzer(s));
appliers.put("allow_leading_wildcard", (qb, s) -> qb.allowLeadingWildcard(Booleans.parseBoolean(s))); appliers.put("allow_leading_wildcard", (qb, s) -> qb.allowLeadingWildcard(Booleans.parseBoolean(s)));
appliers.put("auto_generate_phrase_queries", (qb, s) -> qb.autoGeneratePhraseQueries(Booleans.parseBoolean(s)));
appliers.put("max_determinized_states", (qb, s) -> qb.maxDeterminizedStates(Integer.valueOf(s))); appliers.put("max_determinized_states", (qb, s) -> qb.maxDeterminizedStates(Integer.valueOf(s)));
appliers.put("lowercase_expanded_terms", (qb, s) -> {}); appliers.put("lowercase_expanded_terms", (qb, s) -> {});
appliers.put("enable_position_increments", (qb, s) -> qb.enablePositionIncrements(Booleans.parseBoolean(s))); appliers.put("enable_position_increments", (qb, s) -> qb.enablePositionIncrements(Booleans.parseBoolean(s)));