Showing
1 changed file
with
11 additions
and
6 deletions
@@ -681,7 +681,7 @@ public class SearchService { | @@ -681,7 +681,7 @@ public class SearchService { | ||
681 | * @return | 681 | * @return |
682 | * @throws Exception | 682 | * @throws Exception |
683 | */ | 683 | */ |
684 | - public Map<String, Object> searchNew(Map<String, String> paramMap,Collection<String> producSkns) throws Exception { | 684 | + public Map<String, Object> searchNew(Map<String, String> paramMap, Collection<String> producSkns) throws Exception { |
685 | long begin = System.currentTimeMillis(); | 685 | long begin = System.currentTimeMillis(); |
686 | logger.info("[model=SearchService][func=searchNew][param={}][begin={}][producSkns.size={}]", paramMap.toString(), begin, producSkns == null ? "null" : producSkns.size()); | 686 | logger.info("[model=SearchService][func=searchNew][param={}][begin={}][producSkns.size={}]", paramMap.toString(), begin, producSkns == null ? "null" : producSkns.size()); |
687 | if (producSkns != null) { | 687 | if (producSkns != null) { |
@@ -718,7 +718,7 @@ public class SearchService { | @@ -718,7 +718,7 @@ public class SearchService { | ||
718 | String resultFields = paramMap.get("resultFields"); | 718 | String resultFields = paramMap.get("resultFields"); |
719 | searchParam.setResultFields(Arrays.asList(resultFields.split(","))); | 719 | searchParam.setResultFields(Arrays.asList(resultFields.split(","))); |
720 | } | 720 | } |
721 | - | 721 | + |
722 | // 设置排序字段 | 722 | // 设置排序字段 |
723 | searchParam.setSortFields(buildSort(paramMap)); | 723 | searchParam.setSortFields(buildSort(paramMap)); |
724 | // 进行检索 | 724 | // 进行检索 |
@@ -726,10 +726,10 @@ public class SearchService { | @@ -726,10 +726,10 @@ public class SearchService { | ||
726 | SearchResult searchResult = doSearch(indexName, searchParam); | 726 | SearchResult searchResult = doSearch(indexName, searchParam); |
727 | 727 | ||
728 | // 将searchResult转化为map返回--需要把aggregation转化为需要的结构 | 728 | // 将searchResult转化为map返回--需要把aggregation转化为需要的结构 |
729 | - if (searchResult == null){ | 729 | + if (searchResult == null) { |
730 | return null; | 730 | return null; |
731 | } | 731 | } |
732 | - | 732 | + |
733 | Map<String, Object> dataMap = new HashMap<String, Object>(); | 733 | Map<String, Object> dataMap = new HashMap<String, Object>(); |
734 | dataMap.put("total", searchResult.getTotal()); | 734 | dataMap.put("total", searchResult.getTotal()); |
735 | dataMap.put("page", searchResult.getPage()); | 735 | dataMap.put("page", searchResult.getPage()); |
@@ -1750,7 +1750,6 @@ public class SearchService { | @@ -1750,7 +1750,6 @@ public class SearchService { | ||
1750 | && !ISearchConstans.PARAM_SEARCH_SIZE.equals(filterParamName)) { | 1750 | && !ISearchConstans.PARAM_SEARCH_SIZE.equals(filterParamName)) { |
1751 | int[] sizeids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_SIZE), ","); | 1751 | int[] sizeids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_SIZE), ","); |
1752 | boolFilter.must(FilterBuilders.termsFilter("sizeIds", sizeids)); | 1752 | boolFilter.must(FilterBuilders.termsFilter("sizeIds", sizeids)); |
1753 | - | ||
1754 | } | 1753 | } |
1755 | // 价格 | 1754 | // 价格 |
1756 | if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_PRICE) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_PRICE)) | 1755 | if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_PRICE) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_PRICE)) |
@@ -1769,6 +1768,12 @@ public class SearchService { | @@ -1769,6 +1768,12 @@ public class SearchService { | ||
1769 | int[] genders = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_GENDER), ","); | 1768 | int[] genders = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_GENDER), ","); |
1770 | boolFilter.must(FilterBuilders.termsFilter("gender", genders)); | 1769 | boolFilter.must(FilterBuilders.termsFilter("gender", genders)); |
1771 | } | 1770 | } |
1771 | + // 年龄 | ||
1772 | + if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_AGELEVEL) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_AGELEVEL)) | ||
1773 | + && !ISearchConstans.PARAM_SEARCH_AGELEVEL.equals(filterParamName)) { | ||
1774 | + int[] ageLevels = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_AGELEVEL), ","); | ||
1775 | + boolFilter.must(FilterBuilders.termsFilter("ageLevel", ageLevels)); | ||
1776 | + } | ||
1772 | // 是否特价 | 1777 | // 是否特价 |
1773 | if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_SPECIALOFFER) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER))) { | 1778 | if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_SPECIALOFFER) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER))) { |
1774 | boolFilter.must(FilterBuilders.termFilter(ISearchConstans.PARAM_SEARCH_SPECIALOFFER, paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER))); | 1779 | boolFilter.must(FilterBuilders.termFilter(ISearchConstans.PARAM_SEARCH_SPECIALOFFER, paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER))); |
@@ -1932,7 +1937,7 @@ public class SearchService { | @@ -1932,7 +1937,7 @@ public class SearchService { | ||
1932 | .should(FilterBuilders.rangeFilter("basePinRatio").from(3.5))); | 1937 | .should(FilterBuilders.rangeFilter("basePinRatio").from(3.5))); |
1933 | } | 1938 | } |
1934 | } | 1939 | } |
1935 | - | 1940 | + |
1936 | if (paramMap.containsKey(ISearchConstans.PARAM_SYNC_SKN) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SYNC_SKN))) { | 1941 | if (paramMap.containsKey(ISearchConstans.PARAM_SYNC_SKN) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SYNC_SKN))) { |
1937 | String sknString = paramMap.get(ISearchConstans.PARAM_SYNC_SKN); | 1942 | String sknString = paramMap.get(ISearchConstans.PARAM_SYNC_SKN); |
1938 | boolFilter.must(FilterBuilders.termsFilter("productSkn", sknString.split(","))); | 1943 | boolFilter.must(FilterBuilders.termsFilter("productSkn", sknString.split(","))); |
-
Please register or login to post a comment