Browse Source

REPORT-70681 搜索一些特殊字符 高亮展示时 展示效果不对

new-design
hades 3 years ago
parent
commit
1c99153696
  1. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineUtil.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import java.util.Set;
@ -13,10 +14,15 @@ import java.util.Set;
public class AlphaFineUtil {
public static String highLightModelName(String modelName, String[] strings) {
if (strings == null) {
if (strings == null || ArrayUtils.isEmpty(strings)) {
return modelName;
}
for (String string : strings) {
// 高亮分词 跳过高亮颜色本身的字符
boolean skipHighLight = modelName.contains(AlphaFineConstants.HIGH_LIGHT_COLOR) && AlphaFineConstants.HIGH_LIGHT_COLOR.contains(string);
if (skipHighLight) {
continue;
}
String primaryStr = getReplacedString(modelName, string);
if (StringUtils.isNotEmpty(primaryStr)) {
modelName = modelName.replaceAll("(?i)" + primaryStr, "|<font color=" + AlphaFineConstants.HIGH_LIGHT_COLOR + ">" + primaryStr + "</font>|");

Loading…
Cancel
Save