...
|
...
|
@@ -461,22 +461,44 @@ public class SearchServiceHelper { |
|
|
boolFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isFobbiden, 1));
|
|
|
}
|
|
|
|
|
|
// 通用的过滤请求
|
|
|
for (String key : paramMap.keySet()) {
|
|
|
if (key.startsWith("not_")) {
|
|
|
String[] values = paramMap.get(key).split(",");
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery(key.substring(4, key.length()), values));
|
|
|
}
|
|
|
if (key.startsWith("filter_")) {
|
|
|
String field = key.substring(7, key.length());
|
|
|
boolFilter.must(QueryBuilders.termsQuery(field, paramMap.get(key).split(",")));
|
|
|
}
|
|
|
if (key.startsWith("missing_")) {
|
|
|
String field = key.substring(8, key.length());
|
|
|
boolFilter.mustNot(QueryBuilders.existsQuery(field));
|
|
|
}
|
|
|
// 处理filter_poolId
|
|
|
if (this.checkParamNotFiltered(paramMap, filterParamName, SearchRequestParams.PARAM_SEARCH_FILTER_POOLID)) {
|
|
|
boolFilter.must(QueryBuilders.termsQuery(ProductIndexEsField.poolId, paramMap.get(SearchRequestParams.PARAM_SEARCH_FILTER_POOLID).split(",")));
|
|
|
}
|
|
|
|
|
|
// 处理not_productSkn
|
|
|
if (this.checkParamNotFiltered(paramMap, filterParamName, SearchRequestParams.PARAM_SEARCH_NOT_PRODUCT_SKN)) {
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.productSkn, paramMap.get(SearchRequestParams.PARAM_SEARCH_NOT_PRODUCT_SKN).split(",")));
|
|
|
}
|
|
|
|
|
|
// 处理not_brandId
|
|
|
if (this.checkParamNotFiltered(paramMap, filterParamName, SearchRequestParams.PARAM_SEARCH_NOT_BRAND_ID)) {
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.brandId, paramMap.get(SearchRequestParams.PARAM_SEARCH_NOT_BRAND_ID).split(",")));
|
|
|
}
|
|
|
|
|
|
// 处理not_shopId
|
|
|
if (this.checkParamNotFiltered(paramMap, filterParamName, SearchRequestParams.PARAM_SEARCH_NOT_SHOP_ID)) {
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.shopId, paramMap.get(SearchRequestParams.PARAM_SEARCH_NOT_SHOP_ID).split(",")));
|
|
|
}
|
|
|
|
|
|
// // 通用的过滤请求
|
|
|
// for (String key : paramMap.keySet()) {
|
|
|
// if (key.startsWith("not_")) {
|
|
|
// String[] values = paramMap.get(key).split(",");
|
|
|
// boolFilter.mustNot(QueryBuilders.termsQuery(key.substring(4,
|
|
|
// key.length()), values));
|
|
|
// }
|
|
|
// if (key.startsWith("filter_")) {
|
|
|
// String field = key.substring(7, key.length());
|
|
|
// boolFilter.must(QueryBuilders.termsQuery(field,
|
|
|
// paramMap.get(key).split(",")));
|
|
|
// }
|
|
|
// if (key.startsWith("missing_")) {
|
|
|
// String field = key.substring(8, key.length());
|
|
|
// boolFilter.mustNot(QueryBuilders.existsQuery(field));
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// 规则
|
|
|
if (!"parameter".equals(filterParamName)) {
|
|
|
Iterator<String> itParamKeys = paramMap.keySet().iterator();
|
...
|
...
|
|