summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/suggest/completion
diff options
context:
space:
mode:
authorjavanna <cavannaluca@gmail.com>2015-06-24 16:49:45 +0200
committerLuca Cavanna <cavannaluca@gmail.com>2015-07-02 14:30:01 +0200
commit90f32d4d32cde5ae28fbc6a3e725afafbdf1c58f (patch)
tree5535eb618f42d83d8b440810681d29fd0989003b /core/src/main/java/org/elasticsearch/search/suggest/completion
parent6fda6584664d0dacee1615ec1975dc0243473f2f (diff)
Internal: make sure ParseField is always used in combination with parse flags
Removed ParseField#match variant that accepts the field name only, without parse flags. Such a method is harmful as it defaults to empty parse flags, meaning that no deprecation exceptions will be thrown in strict mode, which defeats the purpose of using ParseField. Unfortunately such a method was used in a lot of places were the parse flags weren't easily accessible (outside of query parsing), and in a lot of other places just by mistake. Parse flags have been introduced now as part of SearchContext and mappers where needed. There are a few places (e.g. java api requests) where it is not possible to retrieve them as they depend on the index settings, in that case we explicitly pass in EMPTY_FLAGS for now, but this has to be seen as an exception. Closes #11859
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/suggest/completion')
-rw-r--r--core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestParser.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestParser.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestParser.java
index 3f7c0ed26b..9802db3813 100644
--- a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestParser.java
+++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionSuggestParser.java
@@ -60,7 +60,7 @@ public class CompletionSuggestParser implements SuggestContextParser {
if (token == XContentParser.Token.FIELD_NAME) {
fieldName = parser.currentName();
} else if (token.isValue()) {
- if (!parseSuggestContext(parser, mapperService, fieldName, suggestion)) {
+ if (!parseSuggestContext(parser, mapperService, fieldName, suggestion, queryParserService.parseFieldMatcher())) {
if (token == XContentParser.Token.VALUE_BOOLEAN && "fuzzy".equals(fieldName)) {
suggestion.setFuzzy(parser.booleanValue());
}
@@ -73,7 +73,7 @@ public class CompletionSuggestParser implements SuggestContextParser {
if (token == XContentParser.Token.FIELD_NAME) {
fuzzyConfigName = parser.currentName();
} else if (token.isValue()) {
- if (FUZZINESS.match(fuzzyConfigName, ParseField.EMPTY_FLAGS)) {
+ if (queryParserService.parseFieldMatcher().match(fuzzyConfigName, FUZZINESS)) {
suggestion.setFuzzyEditDistance(Fuzziness.parse(parser).asDistance());
} else if ("transpositions".equals(fuzzyConfigName)) {
suggestion.setFuzzyTranspositions(parser.booleanValue());