Authored by 胡古飞

加入品牌和品类建议词

... ... @@ -65,19 +65,10 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere
}
// 2、取品牌+品类的组合
Brand brand = brandMap.get(product.getBrandId());
ProductSort productSort = sortMap.get(product.getMaxSortId());
if (brand != null && productSort != null) {
productNameSet.add(brand.getBrandName() + " " + productSort.getSortName());
}
productSort = sortMap.get(product.getMiddleSortId());
if (brand != null && productSort != null) {
productNameSet.add(brand.getBrandName() + " " + productSort.getSortName());
}
productSort = sortMap.get(product.getSmallSortId());
if (brand != null && productSort != null) {
productNameSet.add(brand.getBrandName() + " " + productSort.getSortName());
}
//3、TODO OTHERS
productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getMaxSortId())));
productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getMiddleSortId())));
productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getSmallSortId())));
// 3、TODO OTHERS
}
return productNameSet;
}
... ... @@ -94,4 +85,17 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere
sortMap.clear();
}
private Set<String> getBrandAndSortKeyWord(Brand brand, ProductSort productSort) {
Set<String> results = new HashSet<String>();
if (brand == null || productSort == null) {
return results;
}
String brandName = brand.getBrandName();
String sortName = productSort.getSortName();
for (String itemName : sortName.split("\\/")) {
results.add(brandName + " " + itemName);
}
return results;
}
}
... ...