Authored by 胡古飞

remove invalidate code

@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 6 import org.springframework.stereotype.Service;
7 7
8 import com.yoho.search.core.es.agg.IAggregation; 8 import com.yoho.search.core.es.agg.IAggregation;
9 -import com.yoho.search.service.aggregations.AggInterface;  
10 import com.yoho.search.service.service.SearchCommonService; 9 import com.yoho.search.service.service.SearchCommonService;
11 import com.yoho.search.service.service.base.BrandIndexBaseService; 10 import com.yoho.search.service.service.base.BrandIndexBaseService;
12 import com.yoho.search.service.service.base.ColorIndexBaseService; 11 import com.yoho.search.service.service.base.ColorIndexBaseService;
@@ -24,56 +23,9 @@ public class AggregationFactoryService { @@ -24,56 +23,9 @@ public class AggregationFactoryService {
24 private BrandIndexBaseService brandIndexBaseService; 23 private BrandIndexBaseService brandIndexBaseService;
25 @Autowired 24 @Autowired
26 private ColorIndexBaseService colorIndexBaseService; 25 private ColorIndexBaseService colorIndexBaseService;
27 -  
28 @Autowired 26 @Autowired
29 private IShopsService shopsService; 27 private IShopsService shopsService;
30 28
31 - public IAggregation getSubAggregationByType(int type, Map<String, String> paramMap) {  
32 - IAggregation iAggregation = null;  
33 - switch (type) {  
34 - case AggInterface.AGE_LEVEL:  
35 - iAggregation = new AgeLevelAggregation();  
36 - break;  
37 - case AggInterface.DISCOUNT:  
38 - iAggregation = new DiscountAggregation();  
39 - break;  
40 - case AggInterface.GENDER:  
41 - iAggregation = new GenderAggregation(paramMap);  
42 - break;  
43 - case AggInterface.PRICE:  
44 - iAggregation = new PriceAggregation(searchAfterCacheService);  
45 - break;  
46 - case AggInterface.COLOR:  
47 - iAggregation = new ColorAggregation(colorIndexBaseService, paramMap);  
48 - break;  
49 - case AggInterface.STYLE:  
50 - iAggregation = new StyleAggregation(searchCommonService, paramMap);  
51 - break;  
52 - case AggInterface.BRAND:  
53 - iAggregation = new BrandAggregation(brandIndexBaseService, paramMap);  
54 - break;  
55 - case AggInterface.SIZE:  
56 - iAggregation = new SizeAggregation(searchCommonService);  
57 - break;  
58 - case AggInterface.STANDARD:  
59 - iAggregation = new StandardAggregation(searchCommonService, paramMap);  
60 - break;  
61 - case AggInterface.RECENT_SHELVE_DAY:  
62 - iAggregation = new RecentShelveDayAggregation();  
63 - break;  
64 - case AggInterface.IS_NEW:  
65 - iAggregation = new IsNewAggregation();  
66 - break;  
67 - case AggInterface.IS_LIMITED:  
68 - iAggregation = new IsLimitedAggregation();  
69 - break;  
70 - case AggInterface.IS_SPECIAL:  
71 - iAggregation = new IsSecialofferAggregation();  
72 - break;  
73 - }  
74 - return iAggregation;  
75 - }  
76 -  
77 public IAggregation getAgeLevelAggregation() { 29 public IAggregation getAgeLevelAggregation() {
78 return new AgeLevelAggregation(); 30 return new AgeLevelAggregation();
79 } 31 }
@@ -19,7 +19,6 @@ import com.yoho.search.core.es.agg.IAggregation; @@ -19,7 +19,6 @@ import com.yoho.search.core.es.agg.IAggregation;
19 import com.yoho.search.core.es.model.SearchParam; 19 import com.yoho.search.core.es.model.SearchParam;
20 import com.yoho.search.core.es.model.SearchResult; 20 import com.yoho.search.core.es.model.SearchResult;
21 import com.yoho.search.core.es.utils.IgnoreSomeException; 21 import com.yoho.search.core.es.utils.IgnoreSomeException;
22 -import com.yoho.search.service.aggregations.AggInterface;  
23 import com.yoho.search.service.aggregations.impls.AggregationFactoryService; 22 import com.yoho.search.service.aggregations.impls.AggregationFactoryService;
24 import com.yoho.search.service.service.SearchCacheService; 23 import com.yoho.search.service.service.SearchCacheService;
25 import com.yoho.search.service.service.SearchCommonService; 24 import com.yoho.search.service.service.SearchCommonService;
@@ -77,7 +76,7 @@ public class DiscountServiceImpl implements IDiscountService, ApplicationEventPu @@ -77,7 +76,7 @@ public class DiscountServiceImpl implements IDiscountService, ApplicationEventPu
77 searchParam.setFiter(searchServiceHelper.constructFilterBuilder(paramMap, null)); 76 searchParam.setFiter(searchServiceHelper.constructFilterBuilder(paramMap, null));
78 77
79 // 按1-3,4-6,7-10折的规则进行聚合[按区间聚合] 78 // 按1-3,4-6,7-10折的规则进行聚合[按区间聚合]
80 - IAggregation discountAggregation = aggregationFactoryService.getSubAggregationByType(AggInterface.DISCOUNT, null); 79 + IAggregation discountAggregation = aggregationFactoryService.getDiscountAggregation();
81 searchParam.setAggregationBuilders(Arrays.asList(discountAggregation.getBuilder())); 80 searchParam.setAggregationBuilders(Arrays.asList(discountAggregation.getBuilder()));
82 searchParam.setSize(0); 81 searchParam.setSize(0);
83 82
@@ -124,7 +123,7 @@ public class DiscountServiceImpl implements IDiscountService, ApplicationEventPu @@ -124,7 +123,7 @@ public class DiscountServiceImpl implements IDiscountService, ApplicationEventPu
124 searchParam.setFiter(boolQueryBuilder); 123 searchParam.setFiter(boolQueryBuilder);
125 124
126 // 按1-3,4-6,7-10折的规则进行聚合[按区间聚合] 125 // 按1-3,4-6,7-10折的规则进行聚合[按区间聚合]
127 - IAggregation discountAggregation = aggregationFactoryService.getSubAggregationByType(AggInterface.DISCOUNT, null); 126 + IAggregation discountAggregation = aggregationFactoryService.getDiscountAggregation();
128 searchParam.setAggregationBuilders(Arrays.asList(discountAggregation.getBuilder())); 127 searchParam.setAggregationBuilders(Arrays.asList(discountAggregation.getBuilder()));
129 searchParam.setSize(0); 128 searchParam.setSize(0);
130 129