fix check if pattern exists
@@ -216,11 +216,12 @@ public class ViewHelper {
if (!fessConfig.isResponseHighlightContentTitleEnabled()) {
return value;
}
- return getQuerySet().map(
- querySet -> {
- final Matcher matcher =
- Pattern.compile(querySet.stream().map(LaFunctions::h).map(Pattern::quote).collect(Collectors.joining("|")),
- Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE).matcher(value);
+ return getQuerySet().map(querySet -> {
+ final String pattern = querySet.stream().map(LaFunctions::h).map(Pattern::quote).collect(Collectors.joining("|"));
+ if (StringUtil.isBlank(pattern)) {
+ return null;
+ }
+ final Matcher matcher = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE).matcher(value);
final StringBuffer buf = new StringBuffer(value.length() + 100);
while (matcher.find()) {
matcher.appendReplacement(buf, highlightTagPre + matcher.group(0) + highlightTagPost);
