...
|
...
|
@@ -681,7 +681,7 @@ public class SearchService { |
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Map<String, Object> searchNew(Map<String, String> paramMap,Collection<String> producSkns) throws Exception {
|
|
|
public Map<String, Object> searchNew(Map<String, String> paramMap, Collection<String> producSkns) throws Exception {
|
|
|
long begin = System.currentTimeMillis();
|
|
|
logger.info("[model=SearchService][func=searchNew][param={}][begin={}][producSkns.size={}]", paramMap.toString(), begin, producSkns == null ? "null" : producSkns.size());
|
|
|
if (producSkns != null) {
|
...
|
...
|
@@ -718,7 +718,7 @@ public class SearchService { |
|
|
String resultFields = paramMap.get("resultFields");
|
|
|
searchParam.setResultFields(Arrays.asList(resultFields.split(",")));
|
|
|
}
|
|
|
|
|
|
|
|
|
// 设置排序字段
|
|
|
searchParam.setSortFields(buildSort(paramMap));
|
|
|
// 进行检索
|
...
|
...
|
@@ -726,10 +726,10 @@ public class SearchService { |
|
|
SearchResult searchResult = doSearch(indexName, searchParam);
|
|
|
|
|
|
// 将searchResult转化为map返回--需要把aggregation转化为需要的结构
|
|
|
if (searchResult == null){
|
|
|
if (searchResult == null) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
dataMap.put("total", searchResult.getTotal());
|
|
|
dataMap.put("page", searchResult.getPage());
|
...
|
...
|
@@ -1750,7 +1750,6 @@ public class SearchService { |
|
|
&& !ISearchConstans.PARAM_SEARCH_SIZE.equals(filterParamName)) {
|
|
|
int[] sizeids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_SIZE), ",");
|
|
|
boolFilter.must(FilterBuilders.termsFilter("sizeIds", sizeids));
|
|
|
|
|
|
}
|
|
|
// 价格
|
|
|
if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_PRICE) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_PRICE))
|
...
|
...
|
@@ -1769,6 +1768,12 @@ public class SearchService { |
|
|
int[] genders = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_GENDER), ",");
|
|
|
boolFilter.must(FilterBuilders.termsFilter("gender", genders));
|
|
|
}
|
|
|
// 年龄
|
|
|
if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_AGELEVEL) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_AGELEVEL))
|
|
|
&& !ISearchConstans.PARAM_SEARCH_AGELEVEL.equals(filterParamName)) {
|
|
|
int[] ageLevels = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_AGELEVEL), ",");
|
|
|
boolFilter.must(FilterBuilders.termsFilter("ageLevel", ageLevels));
|
|
|
}
|
|
|
// 是否特价
|
|
|
if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_SPECIALOFFER) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER))) {
|
|
|
boolFilter.must(FilterBuilders.termFilter(ISearchConstans.PARAM_SEARCH_SPECIALOFFER, paramMap.get(ISearchConstans.PARAM_SEARCH_SPECIALOFFER)));
|
...
|
...
|
@@ -1932,7 +1937,7 @@ public class SearchService { |
|
|
.should(FilterBuilders.rangeFilter("basePinRatio").from(3.5)));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (paramMap.containsKey(ISearchConstans.PARAM_SYNC_SKN) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SYNC_SKN))) {
|
|
|
String sknString = paramMap.get(ISearchConstans.PARAM_SYNC_SKN);
|
|
|
boolFilter.must(FilterBuilders.termsFilter("productSkn", sknString.split(",")));
|
...
|
...
|
|