fix #1606 check highlight title lengh
This commit is contained in:
parent
3973e86ef5
commit
e218496af3
1 changed files with 2 additions and 2 deletions
|
@ -148,10 +148,11 @@ public class ViewHelper {
|
|||
|
||||
public String getContentTitle(final Map<String, Object> document) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final int size = fessConfig.getResponseMaxTitleLengthAsInteger();
|
||||
String title =
|
||||
DocumentUtil.getValue(document, ComponentUtil.getQueryHelper().getHighlightPrefix() + fessConfig.getIndexFieldTitle(),
|
||||
String.class);
|
||||
if (StringUtil.isBlank(title)) {
|
||||
if (StringUtil.isBlank(title) || title.length() > size - 3) {
|
||||
title = DocumentUtil.getValue(document, fessConfig.getIndexFieldTitle(), String.class);
|
||||
if (StringUtil.isBlank(title)) {
|
||||
title = DocumentUtil.getValue(document, fessConfig.getIndexFieldFilename(), String.class);
|
||||
|
@ -163,7 +164,6 @@ public class ViewHelper {
|
|||
} else {
|
||||
title = escapeHighlight(title).replaceAll("\\.\\.\\.$", StringUtil.EMPTY);
|
||||
}
|
||||
final int size = fessConfig.getResponseMaxTitleLengthAsInteger();
|
||||
if (size > -1) {
|
||||
return StringUtils.abbreviate(title, size);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue