...
|
...
|
@@ -84,14 +84,14 @@ public class ExtendFilterHelper { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 页面的兜底策略
|
|
|
* 页面的兜底策略-recallValue>0
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder commonRecallValueFilter() {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(QueryBuilders.rangeQuery(ProductIndexEsField.recallValue).gt(0));
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
...
|
...
|
@@ -99,87 +99,75 @@ public class ExtendFilterHelper { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【品类+品牌】人气-【除去新品,新降价和新开促销】
|
|
|
* 【品类+品牌】新品
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder sortBrandHeatValue(SortBrand sortBrand) {
|
|
|
public static QueryBuilder sortBrandNewFilter(SortBrand sortBrand) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
filter.must(newFilter());
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
filter.mustNot(newFilter());
|
|
|
filter.mustNot(latestReducePriceFilter());
|
|
|
filter.mustNot(isNewPromotionFilter());
|
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【品类+品牌】人气-【除去新品,新降价和新开促销】
|
|
|
* 【品类+品牌】新开促销
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder sortBrandCtrValue(SortBrand sortBrand) {
|
|
|
public static QueryBuilder sortBrandPromotion(SortBrand sortBrand) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
filter.must(isNewPromotionFilter());
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
filter.mustNot(newFilter());
|
|
|
filter.mustNot(latestReducePriceFilter());
|
|
|
filter.mustNot(isNewPromotionFilter());
|
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【品类+品牌】新品
|
|
|
* 【品类+品牌】新降价
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder sortBrandNewFilter(SortBrand sortBrand) {
|
|
|
public static QueryBuilder sortBrandReducePrice(SortBrand sortBrand) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
filter.must(newFilter());
|
|
|
filter.must(latestReducePriceFilter());
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
filter.mustNot(latestReducePriceFilter());
|
|
|
filter.mustNot(isNewPromotionFilter());
|
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【品类+品牌】新降价
|
|
|
* 【品类+品牌】人气
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder sortBrandReducePrice(SortBrand sortBrand) {
|
|
|
public static QueryBuilder sortBrandHeatValue(SortBrand sortBrand) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
filter.must(latestReducePriceFilter());
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
filter.mustNot(newFilter());
|
|
|
filter.mustNot(isNewPromotionFilter());
|
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 【品类+品牌】新开促销
|
|
|
* 【品类+品牌】人气
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public static QueryBuilder sortBrandPromotion(SortBrand sortBrand) {
|
|
|
public static QueryBuilder sortBrandCtrValue(SortBrand sortBrand) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
//must
|
|
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
filter.must(isNewPromotionFilter());
|
|
|
//must not
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
filter.mustNot(newFilter());
|
|
|
filter.mustNot(latestReducePriceFilter());
|
|
|
return filter;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -191,7 +179,6 @@ public class ExtendFilterHelper { |
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
|
|
|
private static final List<String> PromotionsTypes = Arrays.asList("Cashreduce", "Cheapestfree", "Degressdiscount", "Discount", "SpecifiedAmount");
|
|
|
|
|
|
private static QueryBuilder newFilter() {
|
...
|
...
|
@@ -224,15 +211,4 @@ public class ExtendFilterHelper { |
|
|
return filter;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
// filter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.flowType, "2"));
|
|
|
// filter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));
|
|
|
// filter.mustNot(QueryBuilders.rangeQuery(ProductIndexEsField.breakSizePercent).gt(50));
|
|
|
filter.mustNot(notRecallFilter());
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
searchParam.setFiter(filter);
|
|
|
System.out.println(SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam).toString());
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|