Authored by 胡古飞

fix SearchKeyWordUtils

... ... @@ -2,6 +2,7 @@ package com.yoho.search.service.utils;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
... ... @@ -19,21 +20,18 @@ public class SearchKeyWordUtils {
}
// 编码转换
String is_encode = paramMap.get("is_encode");
if (StringUtils.isNotBlank(is_encode) && is_encode.equals("1")) {
if ("1".equals(is_encode)) {
try {
keyword = URLDecoder.decode(keyword, "UTF-8");
keyword = URLDecoder.decode(keyword, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
logger.warn(e.getMessage(), e);
}
}
if (keyword.contains("%")) {
keyword.replace("%", "percent");// 特殊处理
}
if (keyword.equals("耐克")) {
keyword = "nike";
}
keyword = keyword.toLowerCase();
return keyword;
}
}
... ...