Skip to content

Commit 91acba6

Browse files
committed
https://github.com/sanluan/PublicCMS/issues/100
1 parent ab7ad35 commit 91acba6

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

publiccms-parent/publiccms-core/src/main/java/com/publiccms/logic/dao/cms/CmsContentSearchDao.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,22 @@ public FacetPageHandler facetQuery(CmsContentSearchQuery queryEntity, String ord
140140
}
141141

142142
private void initHighLighterQuery(HighLighterQuery highLighterQuery, String text) {
143-
if (highLighterQuery.isHighlight() && CommonUtils.notEmpty(text)) {
143+
if (highLighterQuery.isHighlight()) {
144144
highLighterQuery.setFields(highLighterTextFields);
145-
Backend backend = dao.getSearchBackend();
146-
Optional<? extends Analyzer> analyzer;
147-
if (backend instanceof LuceneBackend) {
148-
analyzer = backend.unwrap(LuceneBackend.class).analyzer(CmsContentAttributeBinder.ANALYZER_NAME);
149-
} else {
150-
analyzer = Optional.of(new StandardAnalyzer());
151-
}
152-
if (analyzer.isPresent()) {
153-
MultiFieldQueryParser queryParser = new MultiFieldQueryParser(highLighterTextFields, analyzer.get());
154-
try {
155-
highLighterQuery.setQuery(queryParser.parse(text));
156-
} catch (ParseException e) {
145+
if (CommonUtils.notEmpty(text)) {
146+
Backend backend = dao.getSearchBackend();
147+
Optional<? extends Analyzer> analyzer;
148+
if (backend instanceof LuceneBackend) {
149+
analyzer = backend.unwrap(LuceneBackend.class).analyzer(CmsContentAttributeBinder.ANALYZER_NAME);
150+
} else {
151+
analyzer = Optional.of(new StandardAnalyzer());
152+
}
153+
if (analyzer.isPresent()) {
154+
MultiFieldQueryParser queryParser = new MultiFieldQueryParser(highLighterTextFields, analyzer.get());
155+
try {
156+
highLighterQuery.setQuery(queryParser.parse(text));
157+
} catch (ParseException e) {
158+
}
157159
}
158160
}
159161
}

0 commit comments

Comments
 (0)