Skip to content

Commit

Permalink
undo change in wildcard queries to preserve pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: yogev mets <[email protected]>
  • Loading branch information
yyyogev committed Jul 26, 2022
1 parent 105f68d commit f28e335
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,13 @@ private Query getWildcardQuerySingle(String field, String termStr) throws ParseE
Analyzer oldAnalyzer = getAnalyzer();
try {
MappedFieldType currentFieldType = queryBuilder.context.fieldMapper(field);
if (currentFieldType != null) {
setAnalyzer(getSearchAnalyzer(currentFieldType));
if (currentFieldType == null) {
return newUnmappedFieldQuery(field);
}
if (forceAnalyzer != null && (analyzeWildcard || currentFieldType.getTextSearchInfo().isTokenized())) {
setAnalyzer(forceAnalyzer);
return super.getWildcardQuery(currentFieldType.name(), termStr);
}

if (getAllowLeadingWildcard() == false && (termStr.startsWith("*") || termStr.startsWith("?"))) {
throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery");
}
Expand All @@ -737,6 +740,7 @@ private Query getWildcardQuerySingle(String field, String termStr) throws ParseE
}
}


private Analyzer getSearchAnalyzer(MappedFieldType currentFieldType) {
if (forceAnalyzer == null) {
return queryBuilder.context.getSearchAnalyzer(currentFieldType);
Expand Down

0 comments on commit f28e335

Please sign in to comment.