...
|
...
|
@@ -88,7 +88,7 @@ public class NewGoodProductSceneService { |
|
|
return new SearchApiResult().setCode(400).setMessage("分页参数不合法");
|
|
|
}
|
|
|
|
|
|
// 2、获取推荐的skn参数【插到1、3、8的位置】
|
|
|
// 2、获取推荐的skn参数【插到1、5、8的位置】
|
|
|
List<String> recProductSkns = stringToList(paramMap.getOrDefault(rec_product_skn, ""), ",");
|
|
|
|
|
|
// 3、构造搜索参数
|
...
|
...
|
@@ -121,7 +121,7 @@ public class NewGoodProductSceneService { |
|
|
final String indexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
|
|
|
JSONObject cacheObject = searchCacheService.getJSONObjectFromCache(goodProductSearchCache, indexName, searchParam);
|
|
|
if (cacheObject != null) {
|
|
|
//return new SearchApiResult().setData(cacheObject);
|
|
|
return new SearchApiResult().setData(cacheObject);
|
|
|
}
|
|
|
// 6、查询ES
|
|
|
SearchResult searchResult = searchCommonService.doSearch(indexName, searchParam);
|
...
|
...
|
@@ -152,7 +152,7 @@ public class NewGoodProductSceneService { |
|
|
*/
|
|
|
private String getRandomSeed(Map<String, String> paramMap) {
|
|
|
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
|
|
|
String cacheKey = new StringBuilder("GoodProductUserRandomSeed").append("_").append(uid).toString();
|
|
|
String cacheKey = new StringBuilder("yohosearch:UserGPRandomSeed").append("_").append(uid).toString();
|
|
|
JSONObject jsonObject = searchCacheService.getJSONObjectFromCache(goodProductSearchCache, cacheKey);
|
|
|
if (jsonObject != null) {
|
|
|
return jsonObject.getString("UserGoodProductRandomSeed");
|
...
|
...
|
@@ -206,12 +206,12 @@ public class NewGoodProductSceneService { |
|
|
* @return
|
|
|
*/
|
|
|
private IScorer getPersonalVectorFeatureScorer(BoolQueryBuilder persionalFilter, Map<String, String> paramMap) {
|
|
|
// 3、获取PersonalizedSearch
|
|
|
// 1、获取PersonalizedSearch
|
|
|
PersonalizedSearch personalizedSearch = personalVectorFeatureSearch.getPersonalizedSearch(paramMap);
|
|
|
if (personalizedSearch == null) {
|
|
|
return null;
|
|
|
}
|
|
|
// 3、为个性化打分添加filter条件
|
|
|
// 2、为个性化打分添加filter条件
|
|
|
BoolQueryBuilder scoreFilter = QueryBuilders.boolQuery();
|
|
|
long todayLastTimeSecond = DateUtil.getLastTimeSecond(new Date());
|
|
|
long oneMonthInSecond = 30 * 24 * 60 * 60;
|
...
|
...
|
@@ -226,11 +226,14 @@ public class NewGoodProductSceneService { |
|
|
*/
|
|
|
private BoolQueryBuilder getDefaultBoolQueryBuilder() {
|
|
|
BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery("isSeckill", "Y"));
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery("isGlobal", "Y"));
|
|
|
boolFilter.must(QueryBuilders.termQuery("status", 1));
|
|
|
boolFilter.must(QueryBuilders.termQuery("isOutlets", 2));
|
|
|
boolFilter.must(QueryBuilders.termQuery("attribute", 1));
|
|
|
boolFilter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.isSeckill, "Y"));
|
|
|
boolFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isFobbiden, 1));
|
|
|
boolFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.attribute, 2));
|
|
|
boolFilter.mustNot(QueryBuilders.termQuery(ProductIndexEsField.isGlobal, "Y"));
|
|
|
|
|
|
boolFilter.must(QueryBuilders.termQuery(ProductIndexEsField.isOutlets, 2));
|
|
|
boolFilter.must(QueryBuilders.termQuery(ProductIndexEsField.status, 1));
|
|
|
|
|
|
// 默认推库存>2,非断码,并且短评存在的数据
|
|
|
boolFilter.must(QueryBuilders.rangeQuery("storageNum").gte(2));
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(ProductIndexEsField.breakSizePercent).lt(50));
|
...
|
...
|
|