Authored by hugufei

添加对年龄段的支持

... ... @@ -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) {
... ... @@ -726,7 +726,7 @@ public class SearchService {
SearchResult searchResult = doSearch(indexName, searchParam);
// 将searchResult转化为map返回--需要把aggregation转化为需要的结构
if (searchResult == null){
if (searchResult == null) {
return null;
}
... ... @@ -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)));
... ...