|
@@ -84,14 +84,14 @@ public class ExtendFilterHelper { |
|
@@ -84,14 +84,14 @@ public class ExtendFilterHelper { |
84
|
return null;
|
84
|
return null;
|
85
|
}
|
85
|
}
|
86
|
|
86
|
|
87
|
-
|
|
|
88
|
/**
|
87
|
/**
|
89
|
- * 页面的兜底策略
|
88
|
+ * 页面的兜底策略-recallValue>0
|
90
|
*
|
89
|
*
|
91
|
* @return
|
90
|
* @return
|
92
|
*/
|
91
|
*/
|
93
|
public static QueryBuilder commonRecallValueFilter() {
|
92
|
public static QueryBuilder commonRecallValueFilter() {
|
94
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
93
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
94
|
+ //must
|
95
|
filter.must(QueryBuilders.rangeQuery(ProductIndexEsField.recallValue).gt(0));
|
95
|
filter.must(QueryBuilders.rangeQuery(ProductIndexEsField.recallValue).gt(0));
|
96
|
//must not
|
96
|
//must not
|
97
|
filter.mustNot(notRecallFilter());
|
97
|
filter.mustNot(notRecallFilter());
|
|
@@ -99,87 +99,75 @@ public class ExtendFilterHelper { |
|
@@ -99,87 +99,75 @@ public class ExtendFilterHelper { |
99
|
}
|
99
|
}
|
100
|
|
100
|
|
101
|
/**
|
101
|
/**
|
102
|
- * 【品类+品牌】人气-【除去新品,新降价和新开促销】
|
102
|
+ * 【品类+品牌】新品
|
103
|
*
|
103
|
*
|
104
|
* @return
|
104
|
* @return
|
105
|
*/
|
105
|
*/
|
106
|
- public static QueryBuilder sortBrandHeatValue(SortBrand sortBrand) {
|
106
|
+ public static QueryBuilder sortBrandNewFilter(SortBrand sortBrand) {
|
107
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
107
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
108
|
//must
|
108
|
//must
|
109
|
filter.must(sortBrandIdFilter(sortBrand));
|
109
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
110
|
+ filter.must(newFilter());
|
110
|
//must not
|
111
|
//must not
|
111
|
filter.mustNot(notRecallFilter());
|
112
|
filter.mustNot(notRecallFilter());
|
112
|
- filter.mustNot(newFilter());
|
|
|
113
|
- filter.mustNot(latestReducePriceFilter());
|
|
|
114
|
- filter.mustNot(isNewPromotionFilter());
|
|
|
115
|
return filter;
|
113
|
return filter;
|
116
|
}
|
114
|
}
|
117
|
|
115
|
|
118
|
/**
|
116
|
/**
|
119
|
- * 【品类+品牌】人气-【除去新品,新降价和新开促销】
|
117
|
+ * 【品类+品牌】新开促销
|
120
|
*
|
118
|
*
|
121
|
* @return
|
119
|
* @return
|
122
|
*/
|
120
|
*/
|
123
|
- public static QueryBuilder sortBrandCtrValue(SortBrand sortBrand) {
|
121
|
+ public static QueryBuilder sortBrandPromotion(SortBrand sortBrand) {
|
124
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
122
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
125
|
//must
|
123
|
//must
|
126
|
filter.must(sortBrandIdFilter(sortBrand));
|
124
|
filter.must(sortBrandIdFilter(sortBrand));
|
|
|
125
|
+ filter.must(isNewPromotionFilter());
|
127
|
//must not
|
126
|
//must not
|
128
|
filter.mustNot(notRecallFilter());
|
127
|
filter.mustNot(notRecallFilter());
|
129
|
- filter.mustNot(newFilter());
|
|
|
130
|
- filter.mustNot(latestReducePriceFilter());
|
|
|
131
|
- filter.mustNot(isNewPromotionFilter());
|
|
|
132
|
return filter;
|
128
|
return filter;
|
133
|
}
|
129
|
}
|
134
|
|
130
|
|
135
|
/**
|
131
|
/**
|
136
|
- * 【品类+品牌】新品
|
132
|
+ * 【品类+品牌】新降价
|
137
|
*
|
133
|
*
|
138
|
* @return
|
134
|
* @return
|
139
|
*/
|
135
|
*/
|
140
|
- public static QueryBuilder sortBrandNewFilter(SortBrand sortBrand) {
|
136
|
+ public static QueryBuilder sortBrandReducePrice(SortBrand sortBrand) {
|
141
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
137
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
142
|
//must
|
138
|
//must
|
143
|
filter.must(sortBrandIdFilter(sortBrand));
|
139
|
filter.must(sortBrandIdFilter(sortBrand));
|
144
|
- filter.must(newFilter());
|
140
|
+ filter.must(latestReducePriceFilter());
|
145
|
//must not
|
141
|
//must not
|
146
|
filter.mustNot(notRecallFilter());
|
142
|
filter.mustNot(notRecallFilter());
|
147
|
- filter.mustNot(latestReducePriceFilter());
|
|
|
148
|
- filter.mustNot(isNewPromotionFilter());
|
|
|
149
|
return filter;
|
143
|
return filter;
|
150
|
}
|
144
|
}
|
151
|
|
145
|
|
152
|
/**
|
146
|
/**
|
153
|
- * 【品类+品牌】新降价
|
147
|
+ * 【品类+品牌】人气
|
154
|
*
|
148
|
*
|
155
|
* @return
|
149
|
* @return
|
156
|
*/
|
150
|
*/
|
157
|
- public static QueryBuilder sortBrandReducePrice(SortBrand sortBrand) {
|
151
|
+ public static QueryBuilder sortBrandHeatValue(SortBrand sortBrand) {
|
158
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
152
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
159
|
//must
|
153
|
//must
|
160
|
filter.must(sortBrandIdFilter(sortBrand));
|
154
|
filter.must(sortBrandIdFilter(sortBrand));
|
161
|
- filter.must(latestReducePriceFilter());
|
|
|
162
|
//must not
|
155
|
//must not
|
163
|
filter.mustNot(notRecallFilter());
|
156
|
filter.mustNot(notRecallFilter());
|
164
|
- filter.mustNot(newFilter());
|
|
|
165
|
- filter.mustNot(isNewPromotionFilter());
|
|
|
166
|
return filter;
|
157
|
return filter;
|
167
|
}
|
158
|
}
|
168
|
|
159
|
|
169
|
/**
|
160
|
/**
|
170
|
- * 【品类+品牌】新开促销
|
161
|
+ * 【品类+品牌】人气
|
171
|
*
|
162
|
*
|
172
|
* @return
|
163
|
* @return
|
173
|
*/
|
164
|
*/
|
174
|
- public static QueryBuilder sortBrandPromotion(SortBrand sortBrand) {
|
165
|
+ public static QueryBuilder sortBrandCtrValue(SortBrand sortBrand) {
|
175
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
166
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
176
|
//must
|
167
|
//must
|
177
|
filter.must(sortBrandIdFilter(sortBrand));
|
168
|
filter.must(sortBrandIdFilter(sortBrand));
|
178
|
- filter.must(isNewPromotionFilter());
|
|
|
179
|
//must not
|
169
|
//must not
|
180
|
filter.mustNot(notRecallFilter());
|
170
|
filter.mustNot(notRecallFilter());
|
181
|
- filter.mustNot(newFilter());
|
|
|
182
|
- filter.mustNot(latestReducePriceFilter());
|
|
|
183
|
return filter;
|
171
|
return filter;
|
184
|
}
|
172
|
}
|
185
|
|
173
|
|
|
@@ -191,7 +179,6 @@ public class ExtendFilterHelper { |
|
@@ -191,7 +179,6 @@ public class ExtendFilterHelper { |
191
|
return filter;
|
179
|
return filter;
|
192
|
}
|
180
|
}
|
193
|
|
181
|
|
194
|
-
|
|
|
195
|
private static final List<String> PromotionsTypes = Arrays.asList("Cashreduce", "Cheapestfree", "Degressdiscount", "Discount", "SpecifiedAmount");
|
182
|
private static final List<String> PromotionsTypes = Arrays.asList("Cashreduce", "Cheapestfree", "Degressdiscount", "Discount", "SpecifiedAmount");
|
196
|
|
183
|
|
197
|
private static QueryBuilder newFilter() {
|
184
|
private static QueryBuilder newFilter() {
|
|
@@ -224,15 +211,4 @@ public class ExtendFilterHelper { |
|
@@ -224,15 +211,4 @@ public class ExtendFilterHelper { |
224
|
return filter;
|
211
|
return filter;
|
225
|
}
|
212
|
}
|
226
|
|
213
|
|
227
|
- public static void main(String[] args) {
|
|
|
228
|
- BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
229
|
-// filter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.flowType, "2"));
|
|
|
230
|
-// filter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));
|
|
|
231
|
-// filter.mustNot(QueryBuilders.rangeQuery(ProductIndexEsField.breakSizePercent).gt(50));
|
|
|
232
|
- filter.mustNot(notRecallFilter());
|
|
|
233
|
- SearchParam searchParam = new SearchParam();
|
|
|
234
|
- searchParam.setFiter(filter);
|
|
|
235
|
- System.out.println(SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam).toString());
|
|
|
236
|
- }
|
|
|
237
|
-
|
|
|
238
|
} |
214
|
} |