Skip to content

Commit

Permalink
pr changes
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 d2e6e08 commit 036029a
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -721,15 +721,10 @@ private Query getWildcardQuerySingle(String field, String termStr) throws ParseE
try {
MappedFieldType currentFieldType = queryBuilder.context.fieldMapper(field);
if (currentFieldType != null) {
// return newUnmappedFieldQuery(field);
setAnalyzer(forceAnalyzer == null ? queryBuilder.context.getSearchAnalyzer(currentFieldType) : forceAnalyzer);
setAnalyzer(getSearchAnalyzer(currentFieldType));
indexedNameField = currentFieldType.name();
}

// 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 @@ -745,6 +740,13 @@ private Query getWildcardQuerySingle(String field, String termStr) throws ParseE
}
}

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

@Override
protected Query getRegexpQuery(String field, String termStr) throws ParseException {
final int maxAllowedRegexLength = context.getIndexSettings().getMaxRegexLength();
Expand Down Expand Up @@ -785,14 +787,10 @@ private Query getRegexpQuerySingle(String field, String termStr) throws ParseExc
if (currentFieldType == null) {
return newUnmappedFieldQuery(field);
}
setAnalyzer(forceAnalyzer == null ? queryBuilder.context.getSearchAnalyzer(currentFieldType) : forceAnalyzer);
setAnalyzer(getSearchAnalyzer(currentFieldType));
return super.getRegexpQuery(field, termStr);
// if (forceAnalyzer != null) {
// setAnalyzer(forceAnalyzer);
// return super.getRegexpQuery(field, termStr);
// }
// return currentFieldType.regexpQuery(termStr, RegExp.ALL, 0, getDeterminizeWorkLimit(), getMultiTermRewriteMethod(), context);
} catch (RuntimeException e) {

} catch (RuntimeException e) {
if (lenient) {
return newLenientFieldQuery(field, e);
}
Expand Down

0 comments on commit 036029a

Please sign in to comment.