Authored by Gino Zhang

品牌提取关键词处理关键词用空格连接的情况; 增加productindex中smallSort不分词的字段

... ... @@ -53,19 +53,27 @@ public class SuggestConversionFromBrandIndexBuilder extends IIndexBuilder {
// 根据品牌风格和品牌关键词构建dest
StringBuffer dest = new StringBuffer();
if (StringUtils.isNotEmpty(brand.getBrandStyle())) {
dest.append(brand.getBrandStyle());
dest.append(connectByComma(brand.getBrandStyle()));
}
if (StringUtils.isNotEmpty(brand.getBrandKeyword())) {
if (dest.length() == 0) {
dest.append(brand.getBrandKeyword());
dest.append(connectByComma(brand.getBrandKeyword()));
} else {
dest.append(",").append(brand.getBrandKeyword());
dest.append(",").append(connectByComma(brand.getBrandKeyword()));
}
}
return new ConversionBO(brand.getBrandName(), dest.toString(), DateUtil.getCurrentTimeSecond(), VALID_STATUS);
}
private String connectByComma(String str) {
if (str.contains(",")) {
return str;
}
return str.replaceAll("\\s+", ",").replaceAll(",", ",");
}
@Override
public String getId(Object object) {
return MD5Util.string2MD5(((ConversionBO) object).getSource().trim().toLowerCase());
... ...
... ... @@ -481,7 +481,15 @@
"store": false,
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_complex"
}
},
"smallSort_keyword": {
"type": "string",
"index": "not_analyzed",
"doc_values": true,
"fielddata": {
"format": "doc_values"
}
},
},
"type": "multi_field"
},
... ...