analyzer might end up being null

This commit is contained in:
kimchy 2010-02-26 15:28:38 +02:00
parent e0c3bb5883
commit 1ec1716a7b
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,6 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp
token = jp.nextToken();
assert token == JsonToken.END_OBJECT;
mltQuery.setAnalyzer(parseContext.mapperService().searchAnalyzer());
MapperService.SmartNameFieldMappers smartNameFieldMappers = parseContext.smartFieldMappers(fieldName);
if (smartNameFieldMappers != null) {
if (smartNameFieldMappers.hasMapper()) {
@ -122,6 +121,9 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp
mltQuery.setAnalyzer(smartNameFieldMappers.mapper().searchAnalyzer());
}
}
if (mltQuery.getAnalyzer() == null) {
mltQuery.setAnalyzer(parseContext.mapperService().searchAnalyzer());
}
mltQuery.setMoreLikeFields(new String[]{fieldName});
return wrapSmartNameQuery(mltQuery, smartNameFieldMappers, parseContext.filterCache());
}