...
|
...
|
@@ -12,6 +12,7 @@ import com.yoho.search.dal.model.Brand; |
|
|
import com.yoho.search.dal.model.Product;
|
|
|
import com.yoho.search.dal.model.ProductSort;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeansException;
|
...
|
...
|
@@ -135,8 +136,41 @@ public class ProductIndexLogicService implements ApplicationContextAware { |
|
|
viewBuilderList.stream().forEach(viewBuilder -> {
|
|
|
viewBuilder.build(productIndexBOs, ids, skns);
|
|
|
});
|
|
|
|
|
|
// 构造一个由风格、款式和属性拼接而成的关键词字段 用于关键词推荐
|
|
|
productIndexBOs.forEach(productIndexBO -> {
|
|
|
productIndexBO.setProductAttrField(contrustAttrField(productIndexBO));
|
|
|
});
|
|
|
|
|
|
return productIndexBOs;
|
|
|
}
|
|
|
|
|
|
private String contrustAttrField(ProductIndexBO productIndexBO) {
|
|
|
StringBuffer sb = new StringBuffer(100);
|
|
|
String value = productIndexBO.getStyle();
|
|
|
if(StringUtils.isNotEmpty(value)){
|
|
|
sb.append(value).append(',');
|
|
|
}
|
|
|
|
|
|
value = productIndexBO.getStandardOnlyNames();
|
|
|
if(StringUtils.isNotEmpty(value)){
|
|
|
sb.append(value).append(',');
|
|
|
}
|
|
|
|
|
|
value = productIndexBO.getAttributeNames();
|
|
|
if(StringUtils.isNotEmpty(value)){
|
|
|
sb.append(value).append(',');
|
|
|
}
|
|
|
|
|
|
value = productIndexBO.getPattern();
|
|
|
if(StringUtils.isNotEmpty(value)){
|
|
|
sb.append(value).append(',');
|
|
|
}
|
|
|
|
|
|
if(sb.length() == 0){
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
return sb.substring(0, sb.length() - 1).replaceAll("\\/", ",");
|
|
|
}
|
|
|
} |
...
|
...
|
|