Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
Signed-off-by: yogev mets <[email protected]>
  • Loading branch information
yyyogev committed Jul 24, 2022
1 parent f5351fa commit 04fb97f
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,19 +716,17 @@ private Query getWildcardQuerySingle(String field, String termStr) throws ParseE
// effectively, we check if a field exists or not
return existsQuery(field);
}
String indexedNameField = field;
Analyzer oldAnalyzer = getAnalyzer();
try {
MappedFieldType currentFieldType = queryBuilder.context.fieldMapper(field);
if (currentFieldType != null) {
setAnalyzer(getSearchAnalyzer(currentFieldType));
indexedNameField = currentFieldType.name();
}

if (getAllowLeadingWildcard() == false && (termStr.startsWith("*") || termStr.startsWith("?"))) {
throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
}
return super.getWildcardQuery(indexedNameField, termStr);
return currentFieldType.wildcardQuery(termStr, getMultiTermRewriteMethod(), context);
} catch (RuntimeException e) {
if (lenient) {
return newLenientFieldQuery(field, e);
Expand Down

0 comments on commit 04fb97f

Please sign in to comment.