Authored by Gino Zhang

搜索建议词增加品牌+小品类 从ES聚合获取

@@ -69,7 +69,7 @@ public class BrandWithSortNameSuggestionDiscoverer extends AbstractSuggestionDis @@ -69,7 +69,7 @@ public class BrandWithSortNameSuggestionDiscoverer extends AbstractSuggestionDis
69 Iterator<? extends MultiBucketsAggregation.Bucket> bucketIterator = aggregation.getBuckets().iterator(); 69 Iterator<? extends MultiBucketsAggregation.Bucket> bucketIterator = aggregation.getBuckets().iterator();
70 while (bucketIterator.hasNext()) { 70 while (bucketIterator.hasNext()) {
71 MultiBucketsAggregation.Bucket brandBucket = bucketIterator.next(); 71 MultiBucketsAggregation.Bucket brandBucket = bucketIterator.next();
72 - Integer brandId = (Integer) brandBucket.getKey(); 72 + Integer brandId = Integer.valueOf(brandBucket.getKeyAsString());
73 if (!brandNameMap.containsKey(brandId)) { 73 if (!brandNameMap.containsKey(brandId)) {
74 continue; 74 continue;
75 } 75 }
@@ -80,7 +80,7 @@ public class BrandWithSortNameSuggestionDiscoverer extends AbstractSuggestionDis @@ -80,7 +80,7 @@ public class BrandWithSortNameSuggestionDiscoverer extends AbstractSuggestionDis
80 Iterator<? extends MultiBucketsAggregation.Bucket> smallSortBucketIterator = smallSortAgg.getBuckets().iterator(); 80 Iterator<? extends MultiBucketsAggregation.Bucket> smallSortBucketIterator = smallSortAgg.getBuckets().iterator();
81 while (smallSortBucketIterator.hasNext()) { 81 while (smallSortBucketIterator.hasNext()) {
82 MultiBucketsAggregation.Bucket smallSortBucket = smallSortBucketIterator.next(); 82 MultiBucketsAggregation.Bucket smallSortBucket = smallSortBucketIterator.next();
83 - Integer smallSortId = (Integer) smallSortBucket.getKey(); 83 + Integer smallSortId = Integer.valueOf(smallSortBucket.getKeyAsString());
84 if (sortNameMap.containsKey(smallSortId)) { 84 if (sortNameMap.containsKey(smallSortId)) {
85 brandNameSet.add(brandName + " " + sortNameMap.get(smallSortId)); 85 brandNameSet.add(brandName + " " + sortNameMap.get(smallSortId));
86 } 86 }