Showing
1 changed file
with
17 additions
and
13 deletions
@@ -65,19 +65,10 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere | @@ -65,19 +65,10 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere | ||
65 | } | 65 | } |
66 | // 2、取品牌+品类的组合 | 66 | // 2、取品牌+品类的组合 |
67 | Brand brand = brandMap.get(product.getBrandId()); | 67 | Brand brand = brandMap.get(product.getBrandId()); |
68 | - ProductSort productSort = sortMap.get(product.getMaxSortId()); | ||
69 | - if (brand != null && productSort != null) { | ||
70 | - productNameSet.add(brand.getBrandName() + " " + productSort.getSortName()); | ||
71 | - } | ||
72 | - productSort = sortMap.get(product.getMiddleSortId()); | ||
73 | - if (brand != null && productSort != null) { | ||
74 | - productNameSet.add(brand.getBrandName() + " " + productSort.getSortName()); | ||
75 | - } | ||
76 | - productSort = sortMap.get(product.getSmallSortId()); | ||
77 | - if (brand != null && productSort != null) { | ||
78 | - productNameSet.add(brand.getBrandName() + " " + productSort.getSortName()); | ||
79 | - } | ||
80 | - //3、TODO OTHERS | 68 | + productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getMaxSortId()))); |
69 | + productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getMiddleSortId()))); | ||
70 | + productNameSet.addAll(this.getBrandAndSortKeyWord(brand,sortMap.get(product.getSmallSortId()))); | ||
71 | + // 3、TODO OTHERS | ||
81 | } | 72 | } |
82 | return productNameSet; | 73 | return productNameSet; |
83 | } | 74 | } |
@@ -94,4 +85,17 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere | @@ -94,4 +85,17 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere | ||
94 | sortMap.clear(); | 85 | sortMap.clear(); |
95 | } | 86 | } |
96 | 87 | ||
88 | + private Set<String> getBrandAndSortKeyWord(Brand brand, ProductSort productSort) { | ||
89 | + Set<String> results = new HashSet<String>(); | ||
90 | + if (brand == null || productSort == null) { | ||
91 | + return results; | ||
92 | + } | ||
93 | + String brandName = brand.getBrandName(); | ||
94 | + String sortName = productSort.getSortName(); | ||
95 | + for (String itemName : sortName.split("\\/")) { | ||
96 | + results.add(brandName + " " + itemName); | ||
97 | + } | ||
98 | + return results; | ||
99 | + } | ||
100 | + | ||
97 | } | 101 | } |
-
Please register or login to post a comment