...
|
...
|
@@ -61,17 +61,21 @@ public class UfoSearchQueryHelper extends BaseService { |
|
|
|
|
|
public BoolQueryBuilder constructFilterBuilder(Map<String, String> paramMap, String filterParamName) throws Exception {
|
|
|
BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
|
|
|
//只id过滤
|
|
|
if ("Y".equals(paramMap.get(SearchRequestParams.UFOPRODUCTINDEX_PARAM_IS_ID_FILTER))) {
|
|
|
this.addMustIntTermsQuery(boolFilter, paramMap, filterParamName, SearchRequestParams.UFOPRODUCTINDEX_PARAM_ID, UfoProductIndexEsField.id);
|
|
|
return boolFilter;
|
|
|
}
|
|
|
//硬过滤
|
|
|
if (!"Y".equals(paramMap.get(SearchRequestParams.UFOPRODUCTINDEX_PARAM_IS_ID_FILTER))) {
|
|
|
boolFilter.must(QueryBuilders.termQuery(UfoProductIndexEsField.delStatus, 0));
|
|
|
boolFilter.must(QueryBuilders.termQuery(UfoProductIndexEsField.shelveStatus, 1));
|
|
|
long now = DateUtil.getCurrentTimeSecond();
|
|
|
if ("Y".equals(paramMap.get(SearchRequestParams.UFOPRODUCTINDEX_PARAM_IS_SOON_SALE))) {
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(UfoProductIndexEsField.saleTime).gt(now));
|
|
|
paramMap.put("order", "saleTime:asc");
|
|
|
} else {
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(UfoProductIndexEsField.saleTime).lte(now));
|
|
|
}
|
|
|
boolFilter.must(QueryBuilders.termQuery(UfoProductIndexEsField.delStatus, 0));
|
|
|
boolFilter.must(QueryBuilders.termQuery(UfoProductIndexEsField.shelveStatus, 1));
|
|
|
//是否是即将发售列表
|
|
|
long now = DateUtil.getCurrentTimeSecond();
|
|
|
if ("Y".equals(paramMap.get(SearchRequestParams.UFOPRODUCTINDEX_PARAM_IS_SOON_SALE))) {
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(UfoProductIndexEsField.saleTime).gt(now));
|
|
|
paramMap.put("order", "saleTime:asc");
|
|
|
} else {
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(UfoProductIndexEsField.saleTime).lte(now));
|
|
|
}
|
|
|
//参数过滤
|
|
|
this.addMustIntTermsQuery(boolFilter, paramMap, filterParamName, SearchRequestParams.UFOPRODUCTINDEX_PARAM_ID, UfoProductIndexEsField.id);
|
...
|
...
|
@@ -83,6 +87,11 @@ public class UfoSearchQueryHelper extends BaseService { |
|
|
this.addMustIntTermsQuery(boolFilter, paramMap, filterParamName, SearchRequestParams.UFOPRODUCTINDEX_PARAM_SIZE, UfoProductIndexEsField.sizeIds);
|
|
|
this.addMustIntTermsQuery(boolFilter, paramMap, filterParamName, SearchRequestParams.UFOPRODUCTINDEX_PARAM_COLOR, UfoProductIndexEsField.colorIds);
|
|
|
this.addMustIntTermsQuery(boolFilter, paramMap, filterParamName, SearchRequestParams.UFOPRODUCTINDEX_PARAM_POOL, UfoProductIndexEsField.poolIds);
|
|
|
//推荐列表中去掉自身
|
|
|
String not_id = paramMap.get(SearchRequestParams.UFOPRODUCTINDEX_PARAM_NOT_ID);
|
|
|
if (StringUtils.isNotBlank(not_id)) {
|
|
|
boolFilter.mustNot(QueryBuilders.termQuery(UfoProductIndexEsField.id, not_id));
|
|
|
}
|
|
|
return boolFilter;
|
|
|
}
|
|
|
|
...
|
...
|
|