Authored by 胡古飞

fix SearchServiceHelper

@@ -23,10 +23,7 @@ import com.yoho.search.base.utils.ConvertUtils; @@ -23,10 +23,7 @@ import com.yoho.search.base.utils.ConvertUtils;
23 import com.yoho.search.base.utils.DateUtil; 23 import com.yoho.search.base.utils.DateUtil;
24 import com.yoho.search.base.utils.ISearchConstants; 24 import com.yoho.search.base.utils.ISearchConstants;
25 import com.yoho.search.base.utils.ProductIndexEsField; 25 import com.yoho.search.base.utils.ProductIndexEsField;
26 -import com.yoho.search.service.service.SearchCommonService;  
27 -import com.yoho.search.service.service.SearchDynamicConfigService;  
28 import com.yoho.search.service.service.SearchKeyWordService; 26 import com.yoho.search.service.service.SearchKeyWordService;
29 -import com.yoho.search.service.service.base.ProductIndexBaseService;  
30 import com.yoho.search.service.utils.SearchKeyWordUtils; 27 import com.yoho.search.service.utils.SearchKeyWordUtils;
31 import com.yoho.search.service.utils.SearchRequestParams; 28 import com.yoho.search.service.utils.SearchRequestParams;
32 29
@@ -40,13 +37,7 @@ public class SearchServiceHelper { @@ -40,13 +37,7 @@ public class SearchServiceHelper {
40 @Autowired 37 @Autowired
41 private SearchKeyWordService searchKeyWordService; 38 private SearchKeyWordService searchKeyWordService;
42 @Autowired 39 @Autowired
43 - private SearchDynamicConfigService dynamicConfig;  
44 - @Autowired  
45 - private SearchCommonService searchCommonService;  
46 - @Autowired  
47 private FunctionScoreSearchHelper functionScoreSearchHelper; 40 private FunctionScoreSearchHelper functionScoreSearchHelper;
48 - @Autowired  
49 - private ProductIndexBaseService productIndexBaseService;  
50 41
51 /** 42 /**
52 * 构造关键字查询的query 43 * 构造关键字查询的query
@@ -81,7 +72,7 @@ public class SearchServiceHelper { @@ -81,7 +72,7 @@ public class SearchServiceHelper {
81 72
82 // 4.设置查询字段和比重【AND表示多字段都要匹配,可提高精确度】 73 // 4.设置查询字段和比重【AND表示多字段都要匹配,可提高精确度】
83 this.setDefaultSearchField(queryBuilder, paramMap); 74 this.setDefaultSearchField(queryBuilder, paramMap);
84 - if (ISearchConstants.SEARCH_OPERATOR.equalsIgnoreCase("or")) { 75 + if ("or".equalsIgnoreCase(ISearchConstants.SEARCH_OPERATOR)) {
85 queryBuilder.operator(MatchQueryBuilder.Operator.OR); 76 queryBuilder.operator(MatchQueryBuilder.Operator.OR);
86 queryBuilder.minimumShouldMatch(ISearchConstants.SEARCH_MINIMUM_SHOULD_MATCH); 77 queryBuilder.minimumShouldMatch(ISearchConstants.SEARCH_MINIMUM_SHOULD_MATCH);
87 } else { 78 } else {
@@ -507,7 +498,7 @@ public class SearchServiceHelper { @@ -507,7 +498,7 @@ public class SearchServiceHelper {
507 498
508 // 如果showPhrase=Y,则加上isPhrasein(Y/N),做缓存用 499 // 如果showPhrase=Y,则加上isPhrasein(Y/N),做缓存用
509 if ("Y".equals(paramMap.get(SearchRequestParams.SHOW_PHRASE))) { 500 if ("Y".equals(paramMap.get(SearchRequestParams.SHOW_PHRASE))) {
510 - boolFilter.must(QueryBuilders.termsQuery(ProductIndexEsField.isPhraseExist, Arrays.asList("Y","N"))); 501 + boolFilter.must(QueryBuilders.termsQuery(ProductIndexEsField.isPhraseExist, Arrays.asList("Y", "N")));
511 } 502 }
512 503
513 // 通用的过滤请求 504 // 通用的过滤请求