Remove support for edit_distance in completion suggester
Replaced by fuzziness, consistent with other queries.
This commit is contained in:
parent
69881d5e92
commit
e14c0451d4
|
@ -19,7 +19,6 @@
|
||||||
package org.elasticsearch.search.suggest.completion;
|
package org.elasticsearch.search.suggest.completion;
|
||||||
|
|
||||||
import org.elasticsearch.common.HasContextAndHeaders;
|
import org.elasticsearch.common.HasContextAndHeaders;
|
||||||
import org.elasticsearch.common.ParseField;
|
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.unit.Fuzziness;
|
import org.elasticsearch.common.unit.Fuzziness;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -43,7 +42,6 @@ import static org.elasticsearch.search.suggest.SuggestUtils.parseSuggestContext;
|
||||||
public class CompletionSuggestParser implements SuggestContextParser {
|
public class CompletionSuggestParser implements SuggestContextParser {
|
||||||
|
|
||||||
private CompletionSuggester completionSuggester;
|
private CompletionSuggester completionSuggester;
|
||||||
private static final ParseField FUZZINESS = Fuzziness.FIELD.withDeprecation("edit_distance");
|
|
||||||
|
|
||||||
public CompletionSuggestParser(CompletionSuggester completionSuggester) {
|
public CompletionSuggestParser(CompletionSuggester completionSuggester) {
|
||||||
this.completionSuggester = completionSuggester;
|
this.completionSuggester = completionSuggester;
|
||||||
|
@ -75,7 +73,7 @@ public class CompletionSuggestParser implements SuggestContextParser {
|
||||||
if (token == XContentParser.Token.FIELD_NAME) {
|
if (token == XContentParser.Token.FIELD_NAME) {
|
||||||
fuzzyConfigName = parser.currentName();
|
fuzzyConfigName = parser.currentName();
|
||||||
} else if (token.isValue()) {
|
} else if (token.isValue()) {
|
||||||
if (queryParserService.parseFieldMatcher().match(fuzzyConfigName, FUZZINESS)) {
|
if (queryParserService.parseFieldMatcher().match(fuzzyConfigName, Fuzziness.FIELD)) {
|
||||||
suggestion.setFuzzyEditDistance(Fuzziness.parse(parser).asDistance());
|
suggestion.setFuzzyEditDistance(Fuzziness.parse(parser).asDistance());
|
||||||
} else if ("transpositions".equals(fuzzyConfigName)) {
|
} else if ("transpositions".equals(fuzzyConfigName)) {
|
||||||
suggestion.setFuzzyTranspositions(parser.booleanValue());
|
suggestion.setFuzzyTranspositions(parser.booleanValue());
|
||||||
|
|
Loading…
Reference in New Issue