Browse Source

Merge pull request #8964 in DESIGN/design from final/11.0 to release/11.0

* commit '20179ae6447250b4293e125600fe45465a4786bb':
  REPORT-70681 搜索一些特殊字符 高亮展示时 展示效果不对
release/11.0
superman 3 years ago
parent
commit
6ca4a16e8a
  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