Showing
20 changed files
with
113 additions
and
119 deletions
@@ -6,22 +6,24 @@ import java.io.Serializable; | @@ -6,22 +6,24 @@ import java.io.Serializable; | ||
6 | * Created by wangnan on 2016/6/30. | 6 | * Created by wangnan on 2016/6/30. |
7 | */ | 7 | */ |
8 | public class BrokenCode implements Serializable { | 8 | public class BrokenCode implements Serializable { |
9 | - private Integer productSkn; | ||
10 | - private Double breakingRate; | ||
11 | 9 | ||
12 | - public Integer getProductSkn() { | ||
13 | - return productSkn; | ||
14 | - } | 10 | + private static final long serialVersionUID = -5187295436950928862L; |
11 | + private Integer productSkn; | ||
12 | + private Double breakingRate; | ||
15 | 13 | ||
16 | - public void setProductSkn(Integer productSkn) { | ||
17 | - this.productSkn = productSkn; | ||
18 | - } | 14 | + public Integer getProductSkn() { |
15 | + return productSkn; | ||
16 | + } | ||
19 | 17 | ||
20 | - public Double getBreakingRate() { | ||
21 | - return breakingRate; | ||
22 | - } | 18 | + public void setProductSkn(Integer productSkn) { |
19 | + this.productSkn = productSkn; | ||
20 | + } | ||
23 | 21 | ||
24 | - public void setBreakingRate(Double breakingRate) { | ||
25 | - this.breakingRate = breakingRate; | ||
26 | - } | 22 | + public Double getBreakingRate() { |
23 | + return breakingRate; | ||
24 | + } | ||
25 | + | ||
26 | + public void setBreakingRate(Double breakingRate) { | ||
27 | + this.breakingRate = breakingRate; | ||
28 | + } | ||
27 | } | 29 | } |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class GoodsCoverImage implements Serializable { | ||
9 | - private Integer id; | 7 | +public class GoodsCoverImage{ |
8 | + | ||
9 | + private Integer id; | ||
10 | private Integer goodsId; | 10 | private Integer goodsId; |
11 | private String cover_1; | 11 | private String cover_1; |
12 | private String cover_2; | 12 | private String cover_2; |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductActivity implements Serializable { | ||
9 | - private Integer productSkn; | 7 | +public class ProductActivity{ |
8 | + | ||
9 | + private Integer productSkn; | ||
10 | private String activity; | 10 | private String activity; |
11 | 11 | ||
12 | public Integer getProductSkn() { | 12 | public Integer getProductSkn() { |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/29. | 5 | * Created by wangnan on 2016/6/29. |
7 | */ | 6 | */ |
8 | -public class ProductColors implements Serializable { | 7 | +public class ProductColors { |
9 | private Integer productId; | 8 | private Integer productId; |
10 | private String colorIds; | 9 | private String colorIds; |
11 | private String colorNames; | 10 | private String colorNames; |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductDefaultImage implements Serializable { | 7 | +public class ProductDefaultImage{ |
9 | private Integer productId; | 8 | private Integer productId; |
10 | private String defaultImage; | 9 | private String defaultImage; |
11 | 10 |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductSearchBrand implements Serializable { | 7 | +public class ProductSearchBrand { |
9 | private Integer productSkn; | 8 | private Integer productSkn; |
10 | private Integer brandWeightId; | 9 | private Integer brandWeightId; |
11 | 10 |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | 3 | +public class ProductSearchShop { |
4 | + private Integer productSkn; | ||
5 | + private Integer shopWeightId; | ||
4 | 6 | ||
5 | -public class ProductSearchShop implements Serializable { | ||
6 | - private Integer productSkn; | ||
7 | - private Integer shopWeightId; | ||
8 | public Integer getProductSkn() { | 7 | public Integer getProductSkn() { |
9 | return productSkn; | 8 | return productSkn; |
10 | } | 9 | } |
10 | + | ||
11 | public void setProductSkn(Integer productSkn) { | 11 | public void setProductSkn(Integer productSkn) { |
12 | this.productSkn = productSkn; | 12 | this.productSkn = productSkn; |
13 | } | 13 | } |
14 | + | ||
14 | public Integer getShopWeightId() { | 15 | public Integer getShopWeightId() { |
15 | return shopWeightId; | 16 | return shopWeightId; |
16 | } | 17 | } |
18 | + | ||
17 | public void setShopWeightId(Integer shopWeightId) { | 19 | public void setShopWeightId(Integer shopWeightId) { |
18 | this.shopWeightId = shopWeightId; | 20 | this.shopWeightId = shopWeightId; |
19 | } | 21 | } |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductSearchSort implements Serializable { | ||
9 | - private Integer productSkn; | 7 | +public class ProductSearchSort { |
8 | + | ||
9 | + private Integer productSkn; | ||
10 | private Integer sortWeightId; | 10 | private Integer sortWeightId; |
11 | 11 | ||
12 | public Integer getProductSkn() { | 12 | public Integer getProductSkn() { |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductSizes implements Serializable { | 7 | +public class ProductSizes { |
9 | private Integer productId; | 8 | private Integer productId; |
10 | private String sizeIds; | 9 | private String sizeIds; |
11 | private String sizeNames; | 10 | private String sizeNames; |
12 | - //private Integer salesNum; | ||
13 | private Integer storageNum; | 11 | private Integer storageNum; |
14 | 12 | ||
15 | public Integer getProductId() { | 13 | public Integer getProductId() { |
1 | package com.yoho.search.dal.model; | 1 | package com.yoho.search.dal.model; |
2 | 2 | ||
3 | -import java.io.Serializable; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Created by wangnan on 2016/6/30. | 5 | * Created by wangnan on 2016/6/30. |
7 | */ | 6 | */ |
8 | -public class ProductStyles implements Serializable { | 7 | +public class ProductStyles{ |
9 | private Integer productId; | 8 | private Integer productId; |
10 | private String styleIds; | 9 | private String styleIds; |
11 | 10 |
1 | package com.yoho.search.consumer.index.increment; | 1 | package com.yoho.search.consumer.index.increment; |
2 | 2 | ||
3 | -import com.alibaba.fastjson.JSONArray; | 3 | +import java.util.ArrayList; |
4 | +import java.util.HashMap; | ||
5 | +import java.util.List; | ||
6 | +import java.util.Map; | ||
7 | +import java.util.UUID; | ||
8 | + | ||
9 | +import org.apache.commons.lang.StringUtils; | ||
10 | +import org.slf4j.Logger; | ||
11 | +import org.slf4j.LoggerFactory; | ||
12 | +import org.springframework.amqp.core.Message; | ||
13 | +import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
15 | +import org.springframework.stereotype.Component; | ||
16 | + | ||
4 | import com.alibaba.fastjson.JSONObject; | 17 | import com.alibaba.fastjson.JSONObject; |
5 | import com.rabbitmq.client.Channel; | 18 | import com.rabbitmq.client.Channel; |
6 | import com.yoho.error.event.SearchEvent; | 19 | import com.yoho.error.event.SearchEvent; |
@@ -11,21 +24,10 @@ import com.yoho.search.consumer.common.CostStatistics; | @@ -11,21 +24,10 @@ import com.yoho.search.consumer.common.CostStatistics; | ||
11 | import com.yoho.search.consumer.index.increment.bulks.StorageSkuIndexBulkService; | 24 | import com.yoho.search.consumer.index.increment.bulks.StorageSkuIndexBulkService; |
12 | import com.yoho.search.consumer.index.increment.rule.AbstractStorageRelatedMqListener; | 25 | import com.yoho.search.consumer.index.increment.rule.AbstractStorageRelatedMqListener; |
13 | import com.yoho.search.consumer.service.base.GoodsService; | 26 | import com.yoho.search.consumer.service.base.GoodsService; |
14 | -import com.yoho.search.consumer.service.bo.ProductGoodsBO; | ||
15 | import com.yoho.search.consumer.service.bo.StorageSkuBO; | 27 | import com.yoho.search.consumer.service.bo.StorageSkuBO; |
16 | import com.yoho.search.consumer.service.logic.StorageSkuLogicService; | 28 | import com.yoho.search.consumer.service.logic.StorageSkuLogicService; |
17 | -import com.yoho.search.consumer.service.logic.productIndex.ProductGoodsLogicService; | ||
18 | import com.yoho.search.core.es.utils.IgnoreSomeException; | 29 | import com.yoho.search.core.es.utils.IgnoreSomeException; |
19 | import com.yoho.search.dal.model.Goods; | 30 | import com.yoho.search.dal.model.Goods; |
20 | -import org.apache.commons.lang.StringUtils; | ||
21 | -import org.slf4j.Logger; | ||
22 | -import org.slf4j.LoggerFactory; | ||
23 | -import org.springframework.amqp.core.Message; | ||
24 | -import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
25 | -import org.springframework.beans.factory.annotation.Autowired; | ||
26 | -import org.springframework.stereotype.Component; | ||
27 | - | ||
28 | -import java.util.*; | ||
29 | 31 | ||
30 | @Component | 32 | @Component |
31 | public class GoodsMqListener extends AbstractStorageRelatedMqListener implements ChannelAwareMessageListener { | 33 | public class GoodsMqListener extends AbstractStorageRelatedMqListener implements ChannelAwareMessageListener { |
1 | package com.yoho.search.consumer.index.increment; | 1 | package com.yoho.search.consumer.index.increment; |
2 | 2 | ||
3 | +import java.util.Map; | ||
4 | +import java.util.UUID; | ||
5 | + | ||
6 | +import org.apache.commons.lang.StringUtils; | ||
7 | +import org.slf4j.Logger; | ||
8 | +import org.slf4j.LoggerFactory; | ||
9 | +import org.springframework.amqp.core.Message; | ||
10 | +import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.context.ApplicationEventPublisher; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
3 | import com.alibaba.fastjson.JSONObject; | 15 | import com.alibaba.fastjson.JSONObject; |
4 | import com.rabbitmq.client.Channel; | 16 | import com.rabbitmq.client.Channel; |
5 | import com.yoho.error.event.SearchEvent; | 17 | import com.yoho.error.event.SearchEvent; |
@@ -11,17 +23,6 @@ import com.yoho.search.consumer.index.increment.bulks.GlobalndexBulkService; | @@ -11,17 +23,6 @@ import com.yoho.search.consumer.index.increment.bulks.GlobalndexBulkService; | ||
11 | import com.yoho.search.consumer.service.base.TblProductSkcService; | 23 | import com.yoho.search.consumer.service.base.TblProductSkcService; |
12 | import com.yoho.search.core.es.utils.IgnoreSomeException; | 24 | import com.yoho.search.core.es.utils.IgnoreSomeException; |
13 | import com.yoho.search.dal.model.TblProductSkc; | 25 | import com.yoho.search.dal.model.TblProductSkc; |
14 | -import org.apache.commons.lang.StringUtils; | ||
15 | -import org.slf4j.Logger; | ||
16 | -import org.slf4j.LoggerFactory; | ||
17 | -import org.springframework.amqp.core.Message; | ||
18 | -import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
19 | -import org.springframework.beans.factory.annotation.Autowired; | ||
20 | -import org.springframework.context.ApplicationEventPublisher; | ||
21 | -import org.springframework.stereotype.Component; | ||
22 | - | ||
23 | -import java.util.Map; | ||
24 | -import java.util.UUID; | ||
25 | 26 | ||
26 | /** | 27 | /** |
27 | * Created by wangnan on 2016/12/19. | 28 | * Created by wangnan on 2016/12/19. |
1 | package com.yoho.search.consumer.index.increment; | 1 | package com.yoho.search.consumer.index.increment; |
2 | 2 | ||
3 | +import java.util.Map; | ||
4 | +import java.util.UUID; | ||
5 | + | ||
6 | +import org.apache.commons.lang.StringUtils; | ||
7 | +import org.slf4j.Logger; | ||
8 | +import org.slf4j.LoggerFactory; | ||
9 | +import org.springframework.amqp.core.Message; | ||
10 | +import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
12 | +import org.springframework.context.ApplicationEventPublisher; | ||
13 | +import org.springframework.stereotype.Component; | ||
14 | + | ||
3 | import com.alibaba.fastjson.JSONObject; | 15 | import com.alibaba.fastjson.JSONObject; |
4 | import com.rabbitmq.client.Channel; | 16 | import com.rabbitmq.client.Channel; |
5 | import com.yoho.error.event.SearchEvent; | 17 | import com.yoho.error.event.SearchEvent; |
@@ -11,17 +23,6 @@ import com.yoho.search.consumer.index.increment.bulks.GlobalndexBulkService; | @@ -11,17 +23,6 @@ import com.yoho.search.consumer.index.increment.bulks.GlobalndexBulkService; | ||
11 | import com.yoho.search.consumer.service.base.TblProductSkuService; | 23 | import com.yoho.search.consumer.service.base.TblProductSkuService; |
12 | import com.yoho.search.core.es.utils.IgnoreSomeException; | 24 | import com.yoho.search.core.es.utils.IgnoreSomeException; |
13 | import com.yoho.search.dal.model.TblProductSku; | 25 | import com.yoho.search.dal.model.TblProductSku; |
14 | -import org.apache.commons.lang.StringUtils; | ||
15 | -import org.slf4j.Logger; | ||
16 | -import org.slf4j.LoggerFactory; | ||
17 | -import org.springframework.amqp.core.Message; | ||
18 | -import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener; | ||
19 | -import org.springframework.beans.factory.annotation.Autowired; | ||
20 | -import org.springframework.context.ApplicationEventPublisher; | ||
21 | -import org.springframework.stereotype.Component; | ||
22 | - | ||
23 | -import java.util.Map; | ||
24 | -import java.util.UUID; | ||
25 | 26 | ||
26 | /** | 27 | /** |
27 | * Created by wangnan on 2016/12/19. | 28 | * Created by wangnan on 2016/12/19. |
@@ -4,7 +4,6 @@ import java.util.List; | @@ -4,7 +4,6 @@ import java.util.List; | ||
4 | import java.util.Map; | 4 | import java.util.Map; |
5 | import java.util.UUID; | 5 | import java.util.UUID; |
6 | 6 | ||
7 | -import org.apache.commons.collections.CollectionUtils; | ||
8 | import org.apache.commons.lang.StringUtils; | 7 | import org.apache.commons.lang.StringUtils; |
9 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
10 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
1 | package com.yoho.search.consumer.index.increment.bulks; | 1 | package com.yoho.search.consumer.index.increment.bulks; |
2 | 2 | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | +import java.util.concurrent.ArrayBlockingQueue; | ||
7 | +import java.util.concurrent.ExecutorService; | ||
8 | +import java.util.concurrent.Executors; | ||
9 | + | ||
10 | +import javax.annotation.PostConstruct; | ||
11 | + | ||
12 | +import org.slf4j.Logger; | ||
13 | +import org.slf4j.LoggerFactory; | ||
14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
15 | +import org.springframework.context.ApplicationEventPublisher; | ||
16 | +import org.springframework.context.ApplicationEventPublisherAware; | ||
17 | +import org.springframework.stereotype.Component; | ||
18 | + | ||
3 | import com.alibaba.fastjson.JSONObject; | 19 | import com.alibaba.fastjson.JSONObject; |
4 | import com.yoho.error.event.SearchEvent; | 20 | import com.yoho.error.event.SearchEvent; |
5 | import com.yoho.search.base.utils.EventReportEnum; | 21 | import com.yoho.search.base.utils.EventReportEnum; |
@@ -7,24 +23,10 @@ import com.yoho.search.base.utils.ISearchConstants; | @@ -7,24 +23,10 @@ import com.yoho.search.base.utils.ISearchConstants; | ||
7 | import com.yoho.search.consumer.common.CostStatistics; | 23 | import com.yoho.search.consumer.common.CostStatistics; |
8 | import com.yoho.search.consumer.index.common.IYohoIndexService; | 24 | import com.yoho.search.consumer.index.common.IYohoIndexService; |
9 | import com.yoho.search.consumer.service.bo.StorageSkuBO; | 25 | import com.yoho.search.consumer.service.bo.StorageSkuBO; |
10 | -import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService; | ||
11 | import com.yoho.search.consumer.service.logic.StorageSkuLogicService; | 26 | import com.yoho.search.consumer.service.logic.StorageSkuLogicService; |
27 | +import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService; | ||
12 | import com.yoho.search.core.es.model.ESBluk; | 28 | import com.yoho.search.core.es.model.ESBluk; |
13 | import com.yoho.search.core.es.utils.IgnoreSomeException; | 29 | import com.yoho.search.core.es.utils.IgnoreSomeException; |
14 | -import org.slf4j.Logger; | ||
15 | -import org.slf4j.LoggerFactory; | ||
16 | -import org.springframework.beans.factory.annotation.Autowired; | ||
17 | -import org.springframework.context.ApplicationEventPublisher; | ||
18 | -import org.springframework.context.ApplicationEventPublisherAware; | ||
19 | -import org.springframework.stereotype.Component; | ||
20 | - | ||
21 | -import javax.annotation.PostConstruct; | ||
22 | -import java.util.ArrayList; | ||
23 | -import java.util.List; | ||
24 | -import java.util.Map; | ||
25 | -import java.util.concurrent.ArrayBlockingQueue; | ||
26 | -import java.util.concurrent.ExecutorService; | ||
27 | -import java.util.concurrent.Executors; | ||
28 | 30 | ||
29 | @Component | 31 | @Component |
30 | public class StorageSkuIndexBulkService implements ApplicationEventPublisherAware { | 32 | public class StorageSkuIndexBulkService implements ApplicationEventPublisherAware { |
index/src/main/java/com/yoho/search/consumer/index/increment/rule/DynamicRulePersistenceService.java
1 | package com.yoho.search.consumer.index.increment.rule; | 1 | package com.yoho.search.consumer.index.increment.rule; |
2 | 2 | ||
3 | -import org.apache.curator.framework.CuratorFramework; | ||
4 | -import org.slf4j.Logger; | ||
5 | -import org.slf4j.LoggerFactory; | ||
6 | -import org.springframework.stereotype.Component; | 3 | +import java.util.Map; |
7 | 4 | ||
8 | import javax.annotation.Resource; | 5 | import javax.annotation.Resource; |
9 | -import java.util.Map; | 6 | + |
7 | +import org.apache.curator.framework.CuratorFramework; | ||
8 | +import org.springframework.stereotype.Component; | ||
10 | 9 | ||
11 | /** | 10 | /** |
12 | * 负责持久化rule的值到ZK。 | 11 | * 负责持久化rule的值到ZK。 |
@@ -15,8 +14,6 @@ import java.util.Map; | @@ -15,8 +14,6 @@ import java.util.Map; | ||
15 | @Component | 14 | @Component |
16 | public class DynamicRulePersistenceService { | 15 | public class DynamicRulePersistenceService { |
17 | 16 | ||
18 | - private static final Logger logger = LoggerFactory.getLogger(DynamicRulePersistenceService.class); | ||
19 | - | ||
20 | private static final String CONFIG_ROOT_PATH = "/yh/config"; | 17 | private static final String CONFIG_ROOT_PATH = "/yh/config"; |
21 | 18 | ||
22 | @Resource(name = "curatorFramework") | 19 | @Resource(name = "curatorFramework") |
1 | package com.yoho.search.consumer.job; | 1 | package com.yoho.search.consumer.job; |
2 | 2 | ||
3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
4 | -import java.util.Collections; | ||
5 | -import java.util.Comparator; | ||
6 | import java.util.List; | 4 | import java.util.List; |
7 | import java.util.Map; | 5 | import java.util.Map; |
8 | import java.util.Optional; | 6 | import java.util.Optional; |
1 | package com.yoho.search.consumer.suggests.discover; | 1 | package com.yoho.search.consumer.suggests.discover; |
2 | 2 | ||
3 | +import java.util.HashSet; | ||
4 | +import java.util.List; | ||
5 | +import java.util.Map; | ||
6 | +import java.util.Set; | ||
7 | +import java.util.stream.Collectors; | ||
8 | + | ||
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
10 | + | ||
3 | import com.yoho.search.base.utils.ISearchConstants; | 11 | import com.yoho.search.base.utils.ISearchConstants; |
4 | import com.yoho.search.consumer.index.common.IYohoIndexService; | 12 | import com.yoho.search.consumer.index.common.IYohoIndexService; |
5 | import com.yoho.search.consumer.suggests.common.SuggestSearchParamBuilder; | 13 | import com.yoho.search.consumer.suggests.common.SuggestSearchParamBuilder; |
@@ -8,13 +16,6 @@ import com.yoho.search.consumer.suggests.counter.KeywordCounterService; | @@ -8,13 +16,6 @@ import com.yoho.search.consumer.suggests.counter.KeywordCounterService; | ||
8 | import com.yoho.search.core.es.agg.IAggregation; | 16 | import com.yoho.search.core.es.agg.IAggregation; |
9 | import com.yoho.search.core.es.model.SearchParam; | 17 | import com.yoho.search.core.es.model.SearchParam; |
10 | import com.yoho.search.core.es.model.SearchResult; | 18 | import com.yoho.search.core.es.model.SearchResult; |
11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
12 | - | ||
13 | -import java.util.HashSet; | ||
14 | -import java.util.List; | ||
15 | -import java.util.Map; | ||
16 | -import java.util.Set; | ||
17 | -import java.util.stream.Collectors; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * Created by ginozhang on 2016/11/25. | 21 | * Created by ginozhang on 2016/11/25. |
@@ -36,23 +37,20 @@ public abstract class AbstractAggSuggestionDiscoverer extends AbstractSuggestion | @@ -36,23 +37,20 @@ public abstract class AbstractAggSuggestionDiscoverer extends AbstractSuggestion | ||
36 | if (countMap == null || countMap.isEmpty()) { | 37 | if (countMap == null || countMap.isEmpty()) { |
37 | return 0; | 38 | return 0; |
38 | } | 39 | } |
39 | - | ||
40 | if (tokenList != null) { | 40 | if (tokenList != null) { |
41 | return tokenList.size(); | 41 | return tokenList.size(); |
42 | } | 42 | } |
43 | - | ||
44 | synchronized (this) { | 43 | synchronized (this) { |
45 | if (tokenList != null) { | 44 | if (tokenList != null) { |
46 | return tokenList.size(); | 45 | return tokenList.size(); |
47 | } | 46 | } |
48 | - | ||
49 | tokenList = countMap.keySet().stream().collect(Collectors.toList()); | 47 | tokenList = countMap.keySet().stream().collect(Collectors.toList()); |
50 | } | 48 | } |
51 | - | ||
52 | return tokenList.size(); | 49 | return tokenList.size(); |
53 | } | 50 | } |
54 | - | ||
55 | - private Map<String, Integer> findSuggestionTokenByAgg(IAggregation aggregation) { | 51 | + |
52 | + @SuppressWarnings("unchecked") | ||
53 | + private Map<String, Integer> findSuggestionTokenByAgg(IAggregation aggregation) { | ||
56 | SearchParam searchParam = SuggestSearchParamBuilder.build("", CountUsage.PC); | 54 | SearchParam searchParam = SuggestSearchParamBuilder.build("", CountUsage.PC); |
57 | searchParam.addAbstractAggregationBuilder(aggregation.getBuilder()); | 55 | searchParam.addAbstractAggregationBuilder(aggregation.getBuilder()); |
58 | SearchResult searchResult = yohoIndexService.search(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam); | 56 | SearchResult searchResult = yohoIndexService.search(ISearchConstants.INDEX_NAME_PRODUCT_INDEX, searchParam); |
@@ -70,11 +68,9 @@ public abstract class AbstractAggSuggestionDiscoverer extends AbstractSuggestion | @@ -70,11 +68,9 @@ public abstract class AbstractAggSuggestionDiscoverer extends AbstractSuggestion | ||
70 | if (end > tokenList.size()) { | 68 | if (end > tokenList.size()) { |
71 | end = tokenList.size(); | 69 | end = tokenList.size(); |
72 | } | 70 | } |
73 | - | ||
74 | if (start > end) { | 71 | if (start > end) { |
75 | return sortNameSet; | 72 | return sortNameSet; |
76 | } | 73 | } |
77 | - | ||
78 | tokenList.subList(start, end).forEach((item) -> sortNameSet.add(item)); | 74 | tokenList.subList(start, end).forEach((item) -> sortNameSet.add(item)); |
79 | return sortNameSet; | 75 | return sortNameSet; |
80 | } | 76 | } |
1 | package com.yoho.search.consumer.suggests.discover; | 1 | package com.yoho.search.consumer.suggests.discover; |
2 | 2 | ||
3 | +import java.util.HashSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import javax.annotation.Resource; | ||
7 | + | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
3 | import com.yoho.core.redis.YHHashOperations; | 10 | import com.yoho.core.redis.YHHashOperations; |
4 | import com.yoho.core.redis.YHZSetOperations; | 11 | import com.yoho.core.redis.YHZSetOperations; |
5 | import com.yoho.search.consumer.suggests.common.KeywordType; | 12 | import com.yoho.search.consumer.suggests.common.KeywordType; |
6 | import com.yoho.search.consumer.suggests.common.SuggestionConstants; | 13 | import com.yoho.search.consumer.suggests.common.SuggestionConstants; |
7 | -import org.springframework.data.redis.core.ZSetOperations; | ||
8 | -import org.springframework.stereotype.Component; | ||
9 | - | ||
10 | -import javax.annotation.Resource; | ||
11 | -import java.util.HashSet; | ||
12 | -import java.util.Set; | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Created by ginozhang on 2016/11/25. | 16 | * Created by ginozhang on 2016/11/25. |
@@ -10,7 +10,6 @@ import org.springframework.stereotype.Component; | @@ -10,7 +10,6 @@ import org.springframework.stereotype.Component; | ||
10 | 10 | ||
11 | import com.yoho.search.consumer.service.base.TblSortService; | 11 | import com.yoho.search.consumer.service.base.TblSortService; |
12 | import com.yoho.search.consumer.suggests.common.KeywordType; | 12 | import com.yoho.search.consumer.suggests.common.KeywordType; |
13 | -import com.yoho.search.dal.model.ProductSort; | ||
14 | import com.yoho.search.dal.model.TblSort; | 13 | import com.yoho.search.dal.model.TblSort; |
15 | 14 | ||
16 | @Component | 15 | @Component |
-
Please register or login to post a comment