Query DSL: Fuzzy Like This, closes #103.

This commit is contained in:
kimchy 2010-04-02 21:55:37 +03:00
parent 58d2e2e1fc
commit 408bad62f3
1 changed files with 4 additions and 1 deletions

View File

@ -118,7 +118,7 @@ public class FuzzyLikeThisFieldJsonQueryParser extends AbstractIndexComponent im
throw new QueryParsingException(index, "fuzzyLikeThisField requires 'likeText' to be specified");
}
Analyzer analyzer = parseContext.mapperService().searchAnalyzer();
Analyzer analyzer = null;
MapperService.SmartNameFieldMappers smartNameFieldMappers = parseContext.smartFieldMappers(fieldName);
if (smartNameFieldMappers != null) {
if (smartNameFieldMappers.hasMapper()) {
@ -126,6 +126,9 @@ public class FuzzyLikeThisFieldJsonQueryParser extends AbstractIndexComponent im
analyzer = smartNameFieldMappers.mapper().searchAnalyzer();
}
}
if (analyzer == null) {
analyzer = parseContext.mapperService().searchAnalyzer();
}
FuzzyLikeThisQuery query = new FuzzyLikeThisQuery(maxNumTerms, analyzer);
query.addTerms(likeText, fieldName, minSimilarity, prefixLength);