@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine;
import com.fr.design.DesignerEnvManager ;
import com.fr.design.DesignerEnvManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager ;
import com.fr.stable.ArrayUtils ;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
import java.util.Set ;
import java.util.Set ;
@ -13,10 +14,15 @@ import java.util.Set;
public class AlphaFineUtil {
public class AlphaFineUtil {
public static String highLightModelName ( String modelName , String [ ] strings ) {
public static String highLightModelName ( String modelName , String [ ] strings ) {
if ( strings = = null ) {
if ( strings = = null | | ArrayUtils . isEmpty ( strings ) ) {
return modelName ;
return modelName ;
}
}
for ( String string : strings ) {
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 ) ;
String primaryStr = getReplacedString ( modelName , string ) ;
if ( StringUtils . isNotEmpty ( primaryStr ) ) {
if ( StringUtils . isNotEmpty ( primaryStr ) ) {
modelName = modelName . replaceAll ( "(?i)" + primaryStr , "|<font color=" + AlphaFineConstants . HIGH_LIGHT_COLOR + ">" + primaryStr + "</font>|" ) ;
modelName = modelName . replaceAll ( "(?i)" + primaryStr , "|<font color=" + AlphaFineConstants . HIGH_LIGHT_COLOR + ">" + primaryStr + "</font>|" ) ;