Authored by hugufei

fix ConsumerConfiger

1 -package com.yoho.search.consumer.suggests.common;  
2 -  
3 -import com.yoho.search.base.beans.SearchPropertyPlaceholderConfigurer;  
4 -import org.springframework.beans.factory.annotation.Autowired;  
5 -import org.springframework.stereotype.Component;  
6 -  
7 -import java.util.List;  
8 -  
9 -@Component  
10 -public class ConsumerConfiger {  
11 -  
12 - @Autowired  
13 - private SearchPropertyPlaceholderConfigurer configurer;  
14 -  
15 - /******************************for full build**************************************/  
16 - public int getSearchIndexBatchLimit(){  
17 - return configurer.getInt("search.index.batch.limit", 5000);  
18 - }  
19 -  
20 - public int getSearchIndexBatchMaxThreadSize(){  
21 - return configurer.getInt("search.index.batch.max.thread.size", 5);  
22 - }  
23 -  
24 - /******************************for tbl**************************************/  
25 - public String getTblProductUrl(){  
26 - return configurer.getString("tbl.product.url", "http://test.soa.global.yohobuy.com/product/api/v1/detail/");  
27 - }  
28 -  
29 - public String getTblPrimaryKey(){  
30 - return configurer.getString("tbl.product.private.key", "a85bb0674e08986c6b115d5e3a4884fa");  
31 - }  
32 -  
33 - public String getTblAdaptorDomain(){  
34 - return configurer.getString("tpl.adaptor.domain", "http://192.168.102.224:8085/search-adaptor");  
35 - }  
36 -  
37 - /******************************for Suggestion**************************************/  
38 - public int getSuggestionCountBatchLimit (){  
39 - return configurer.getInt("suggestion.count.batch.limit", 300);  
40 - }  
41 - public int getSuggestionCountBatchMaxThreadSize(){  
42 - return configurer.getInt("suggestion.count.batch.max.thread.size", 1);  
43 - }  
44 -  
45 - public int getSuggestionDiscoverBatchLimit(){  
46 - return configurer.getInt("suggestion.discover.batch.limit", 500);  
47 - }  
48 -  
49 - public int getSuggestionDiscoverBatchMaxThreadSize(){  
50 - return configurer.getInt("suggestion.discover.batch.max.thread.size", 3);  
51 - }  
52 -  
53 -  
54 - /******************************for search**************************************/  
55 - public List<String> getSearchDefaultField(){  
56 - return configurer.getList("search.default.field");  
57 - }  
58 -  
59 - public String getSearchMultiMatchQueryType(){  
60 - return configurer.getString("search.multiMatchQuery.type", "BEST_FIELDS");  
61 - }  
62 -  
63 - public String getSearchOperator(){  
64 - return configurer.getString("search.operator", "or");  
65 - }  
66 -  
67 - public String getSearchMinimumShouldMatch(){  
68 - return configurer.getString("search.minimum.should.match", "75%");  
69 - }  
70 -  
71 -} 1 +package com.yoho.search.consumer.common;
  2 +
  3 +import com.yoho.search.base.beans.SearchPropertyPlaceholderConfigurer;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Component;
  6 +
  7 +import java.util.List;
  8 +
  9 +@Component
  10 +public class ConsumerConfiger {
  11 +
  12 + @Autowired
  13 + private SearchPropertyPlaceholderConfigurer configurer;
  14 +
  15 + /******************************for full build**************************************/
  16 + public int getSearchIndexBatchLimit(){
  17 + return configurer.getInt("search.index.batch.limit", 5000);
  18 + }
  19 +
  20 + public int getSearchIndexBatchMaxThreadSize(){
  21 + return configurer.getInt("search.index.batch.max.thread.size", 5);
  22 + }
  23 +
  24 + /******************************for tbl**************************************/
  25 + public String getTblProductUrl(){
  26 + return configurer.getString("tbl.product.url", "http://test.soa.global.yohobuy.com/product/api/v1/detail/");
  27 + }
  28 +
  29 + public String getTblPrimaryKey(){
  30 + return configurer.getString("tbl.product.private.key", "a85bb0674e08986c6b115d5e3a4884fa");
  31 + }
  32 +
  33 + public String getTblAdaptorDomain(){
  34 + return configurer.getString("tpl.adaptor.domain", "http://192.168.102.224:8085/search-adaptor");
  35 + }
  36 +
  37 + /******************************for Suggestion**************************************/
  38 + public int getSuggestionCountBatchLimit (){
  39 + return configurer.getInt("suggestion.count.batch.limit", 300);
  40 + }
  41 + public int getSuggestionCountBatchMaxThreadSize(){
  42 + return configurer.getInt("suggestion.count.batch.max.thread.size", 1);
  43 + }
  44 +
  45 + public int getSuggestionDiscoverBatchLimit(){
  46 + return configurer.getInt("suggestion.discover.batch.limit", 500);
  47 + }
  48 +
  49 + public int getSuggestionDiscoverBatchMaxThreadSize(){
  50 + return configurer.getInt("suggestion.discover.batch.max.thread.size", 3);
  51 + }
  52 +
  53 +
  54 + /******************************for search**************************************/
  55 + public List<String> getSearchDefaultField(){
  56 + return configurer.getList("search.default.field");
  57 + }
  58 +
  59 + public String getSearchMultiMatchQueryType(){
  60 + return configurer.getString("search.multiMatchQuery.type", "BEST_FIELDS");
  61 + }
  62 +
  63 + public String getSearchOperator(){
  64 + return configurer.getString("search.operator", "or");
  65 + }
  66 +
  67 + public String getSearchMinimumShouldMatch(){
  68 + return configurer.getString("search.minimum.should.match", "75%");
  69 + }
  70 +
  71 +}
@@ -9,7 +9,7 @@ import java.util.concurrent.Future; @@ -9,7 +9,7 @@ import java.util.concurrent.Future;
9 9
10 import javax.annotation.PostConstruct; 10 import javax.annotation.PostConstruct;
11 11
12 -import com.yoho.search.consumer.suggests.common.ConsumerConfiger; 12 +import com.yoho.search.consumer.common.ConsumerConfiger;
13 import org.elasticsearch.action.bulk.BulkResponse; 13 import org.elasticsearch.action.bulk.BulkResponse;
14 import org.slf4j.Logger; 14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
@@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject; @@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject;
6 import com.yoho.search.base.utils.HttpClientUtils; 6 import com.yoho.search.base.utils.HttpClientUtils;
7 import com.yoho.search.base.utils.MD5Util; 7 import com.yoho.search.base.utils.MD5Util;
8 import com.yoho.search.consumer.index.common.IIndexBuilder; 8 import com.yoho.search.consumer.index.common.IIndexBuilder;
9 -import com.yoho.search.consumer.suggests.common.ConsumerConfiger; 9 +import com.yoho.search.consumer.common.ConsumerConfiger;
10 import org.apache.commons.lang.StringUtils; 10 import org.apache.commons.lang.StringUtils;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
@@ -4,7 +4,7 @@ import java.util.Calendar; @@ -4,7 +4,7 @@ import java.util.Calendar;
4 import java.util.Date; 4 import java.util.Date;
5 import java.util.List; 5 import java.util.List;
6 6
7 -import com.yoho.search.consumer.suggests.common.ConsumerConfiger; 7 +import com.yoho.search.consumer.common.ConsumerConfiger;
8 import org.apache.commons.collections.CollectionUtils; 8 import org.apache.commons.collections.CollectionUtils;
9 import org.apache.commons.lang3.StringUtils; 9 import org.apache.commons.lang3.StringUtils;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component; @@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
15 15
16 import com.yoho.search.base.utils.DateStyle; 16 import com.yoho.search.base.utils.DateStyle;
17 import com.yoho.search.base.utils.DateUtil; 17 import com.yoho.search.base.utils.DateUtil;
18 -import com.yoho.search.base.utils.ISearchConstants;  
19 import com.yoho.search.consumer.index.increment.flow.ProductIndexFeatureVectorUpdateFlow; 18 import com.yoho.search.consumer.index.increment.flow.ProductIndexFeatureVectorUpdateFlow;
20 import com.yoho.search.consumer.service.daoService.ProductVectorFeatureService; 19 import com.yoho.search.consumer.service.daoService.ProductVectorFeatureService;
21 import com.yoho.search.consumer.service.logicService.personal.PersonalVectorVersionManager; 20 import com.yoho.search.consumer.service.logicService.personal.PersonalVectorVersionManager;
1 package com.yoho.search.consumer.job; 1 package com.yoho.search.consumer.job;
2 2
3 -import com.yoho.search.consumer.suggests.common.ConsumerConfiger; 3 +import com.yoho.search.consumer.common.ConsumerConfiger;
4 import com.yoho.search.consumer.suggests.common.RetryBusinessFlowExecutor; 4 import com.yoho.search.consumer.suggests.common.RetryBusinessFlowExecutor;
5 import com.yoho.search.consumer.suggests.common.SuggestionCache; 5 import com.yoho.search.consumer.suggests.common.SuggestionCache;
6 -import com.yoho.search.consumer.suggests.common.SuggestionConstants;  
7 import com.yoho.search.consumer.suggests.counter.AbstractSuggestionCounter; 6 import com.yoho.search.consumer.suggests.counter.AbstractSuggestionCounter;
8 import com.yoho.search.consumer.suggests.discover.AbstractSuggestionDiscoverer; 7 import com.yoho.search.consumer.suggests.discover.AbstractSuggestionDiscoverer;
9 import org.slf4j.Logger; 8 import org.slf4j.Logger;
@@ -10,7 +10,7 @@ import com.yoho.search.base.utils.ISearchConstants; @@ -10,7 +10,7 @@ import com.yoho.search.base.utils.ISearchConstants;
10 import com.yoho.search.consumer.index.common.IYohoIndexService; 10 import com.yoho.search.consumer.index.common.IYohoIndexService;
11 import com.yoho.search.consumer.service.bo.ProductIndexBO; 11 import com.yoho.search.consumer.service.bo.ProductIndexBO;
12 import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService; 12 import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService;
13 -import com.yoho.search.consumer.suggests.common.ConsumerConfiger; 13 +import com.yoho.search.consumer.common.ConsumerConfiger;
14 import com.yoho.search.core.es.model.ESBluk; 14 import com.yoho.search.core.es.model.ESBluk;
15 import com.yoho.search.core.es.utils.IgnoreSomeException; 15 import com.yoho.search.core.es.utils.IgnoreSomeException;
16 import org.apache.commons.lang3.StringUtils; 16 import org.apache.commons.lang3.StringUtils;
@@ -2,6 +2,7 @@ package com.yoho.search.consumer.suggests.common; @@ -2,6 +2,7 @@ package com.yoho.search.consumer.suggests.common;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
  5 +import com.yoho.search.consumer.common.ConsumerConfiger;
5 import org.apache.commons.lang3.StringUtils; 6 import org.apache.commons.lang3.StringUtils;
6 import org.elasticsearch.index.query.BoolQueryBuilder; 7 import org.elasticsearch.index.query.BoolQueryBuilder;
7 import org.elasticsearch.index.query.MultiMatchQueryBuilder; 8 import org.elasticsearch.index.query.MultiMatchQueryBuilder;
@@ -10,7 +11,6 @@ import org.elasticsearch.index.query.QueryBuilder; @@ -10,7 +11,6 @@ import org.elasticsearch.index.query.QueryBuilder;
10 import org.elasticsearch.index.query.QueryBuilders; 11 import org.elasticsearch.index.query.QueryBuilders;
11 12
12 import com.yoho.search.base.utils.ConvertUtils; 13 import com.yoho.search.base.utils.ConvertUtils;
13 -import com.yoho.search.base.utils.ISearchConstants;  
14 import com.yoho.search.consumer.suggests.counter.CountUsage; 14 import com.yoho.search.consumer.suggests.counter.CountUsage;
15 import com.yoho.search.core.es.model.SearchParam; 15 import com.yoho.search.core.es.model.SearchParam;
16 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
1 package com.yoho.search.consumer.suggests.common; 1 package com.yoho.search.consumer.suggests.common;
2 2
3 import com.yoho.search.base.utils.CharUtils; 3 import com.yoho.search.base.utils.CharUtils;
4 -import com.yoho.search.base.utils.ISearchConstants; 4 +import com.yoho.search.consumer.common.ConsumerConfiger;
5 import com.yoho.search.consumer.service.daoService.SuggestWordDefService; 5 import com.yoho.search.consumer.service.daoService.SuggestWordDefService;
6 import com.yoho.search.dal.model.SuggestWordDef; 6 import com.yoho.search.dal.model.SuggestWordDef;
7 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
1 package com.yoho.search.consumer.suggests.discover; 1 package com.yoho.search.consumer.suggests.discover;
2 2
  3 +import com.yoho.search.consumer.common.ConsumerConfiger;
3 import com.yoho.search.consumer.common.DynamicConfigService; 4 import com.yoho.search.consumer.common.DynamicConfigService;
4 import com.yoho.search.consumer.index.rebuild.RebuildFlagService; 5 import com.yoho.search.consumer.index.rebuild.RebuildFlagService;
5 import com.yoho.search.consumer.service.daoService.SuggestWordDefService; 6 import com.yoho.search.consumer.service.daoService.SuggestWordDefService;