...
|
...
|
@@ -16,7 +16,6 @@ import java.util.Set; |
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.elasticsearch.action.search.SearchType;
|
|
|
import org.elasticsearch.index.query.BoolFilterBuilder;
|
|
|
import org.elasticsearch.index.query.FilterBuilder;
|
|
|
import org.elasticsearch.index.query.FilterBuilders;
|
|
|
import org.elasticsearch.index.query.MatchQueryBuilder;
|
|
|
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
|
...
|
...
|
@@ -96,7 +95,7 @@ public class SearchService { |
|
|
jsonMap.put("data", "");
|
|
|
return jsonMap;
|
|
|
}
|
|
|
//获取聚合结果
|
|
|
// 获取聚合结果
|
|
|
Object discountAggResult = discountAggregation.getAggregationResponseMap(searchResult.getAggMaps());
|
|
|
if (discountAggResult != null) {
|
|
|
Map<String, Object> filter = new HashMap<String, Object>();
|
...
|
...
|
@@ -158,7 +157,7 @@ public class SearchService { |
|
|
jsonMap.put("data", "");
|
|
|
return jsonMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 获取聚合结果
|
|
|
Object recentShelveDayResponse = recentShelveDayAggregation.getAggregationResponseMap(searchResult.getAggMaps());
|
|
|
if (recentShelveDayResponse != null) {
|
...
|
...
|
@@ -383,8 +382,8 @@ public class SearchService { |
|
|
}
|
|
|
searchParam.setAggregationBuilders(Arrays.asList(aggregationBuilder));
|
|
|
searchParam.setSearchType(SearchType.COUNT);
|
|
|
|
|
|
//查询
|
|
|
|
|
|
// 查询
|
|
|
final String indexName = ISearchConstans.INDEX_NAME_PRODUCT_INDEX;
|
|
|
SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
|
|
|
Map<String, Object> jsonMap = new HashMap<String, Object>();
|
...
|
...
|
@@ -436,6 +435,10 @@ public class SearchService { |
|
|
String[] genders = paramMap.get(ISearchConstans.PARAM_SEARCH_GENDER).split(",");
|
|
|
boolFilter.must(FilterBuilders.termsFilter("gender", genders));
|
|
|
}
|
|
|
// 如果contain_global!=Y,则过滤掉全球购的商品[全球购商品融合需求]
|
|
|
if (!paramMap.containsKey("contain_global") || !"Y".equals(paramMap.get("contain_global")) || !ISearchConstans.SEARCH_CONTAIL_GLOBAL) {
|
|
|
boolFilter.must(FilterBuilders.termsFilter("isGlobal", "N"));
|
|
|
}
|
|
|
if (boolFilter.hasClauses()) {
|
|
|
searchParam.setFiter(boolFilter);
|
|
|
}
|
...
|
...
|
@@ -628,9 +631,13 @@ public class SearchService { |
|
|
}
|
|
|
queryBuilder.minimumShouldMatch(ISearchConstans.SEARCH_MINIMUM_SHOULD_MATCH);
|
|
|
searchParam.setQuery(queryBuilder);
|
|
|
FilterBuilder filterBuilder = FilterBuilders.boolFilter().must(FilterBuilders.termFilter("status", 1)).mustNot(FilterBuilders.termFilter("attribute", 2))
|
|
|
BoolFilterBuilder boolFilterBuilder = FilterBuilders.boolFilter().must(FilterBuilders.termFilter("status", 1)).mustNot(FilterBuilders.termFilter("attribute", 2))
|
|
|
.must(FilterBuilders.rangeFilter("storageNum").gte(1)).must(FilterBuilders.termFilter("isOutlets", 2));
|
|
|
searchParam.setFiter(filterBuilder);
|
|
|
// 如果contain_global!=Y,则过滤掉全球购的商品[全球购商品融合需求]
|
|
|
if (!paramMap.containsKey("contain_global") || !"Y".equals(paramMap.get("contain_global")) || !ISearchConstans.SEARCH_CONTAIL_GLOBAL) {
|
|
|
boolFilterBuilder.must(FilterBuilders.termsFilter("isGlobal", "N"));
|
|
|
}
|
|
|
searchParam.setFiter(boolFilterBuilder);
|
|
|
searchParam.setSearchType(SearchType.COUNT);
|
|
|
final String indexName = ISearchConstans.INDEX_NAME_PRODUCT_INDEX;
|
|
|
SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
|
...
|
...
|
|