...
|
...
|
@@ -67,7 +67,7 @@ public class SearchLikeServiceImpl implements ISearchLikeService { |
|
|
private int sortMaxBoost = 1000;
|
|
|
private int brandMaxBoost = 700;
|
|
|
private int productNameMaxBoost = 600;
|
|
|
private int standardOnlyNamesBoost = 400;
|
|
|
private int standardOnlyNamesBoost = 500;
|
|
|
private int otherBoost = 150;
|
|
|
|
|
|
private void addSearchFieldBoost(List<String> searchFields, float maxBoost) {
|
...
|
...
|
@@ -123,8 +123,8 @@ public class SearchLikeServiceImpl implements ISearchLikeService { |
|
|
pageSize = 60;
|
|
|
}
|
|
|
|
|
|
// 4、获取同一个品牌下的最多20个商品
|
|
|
JSONArray inBrandProductList = this.getProductListInBrand(productInfoInEs, paramMap, 20);
|
|
|
// 4、获取同一个品牌下一半商品
|
|
|
JSONArray inBrandProductList = this.getProductListInBrand(productInfoInEs, paramMap, pageSize/2);
|
|
|
|
|
|
// 5、获取不同品牌下的余下数量的商品[通过聚合的方式来查找]
|
|
|
List<String> notInProductSkns = new ArrayList<String>();
|
...
|
...
|
@@ -308,12 +308,13 @@ public class SearchLikeServiceImpl implements ISearchLikeService { |
|
|
// 1、设置查询的值
|
|
|
String productName = productInfoInEs.getString("productName");
|
|
|
String standardOnlyNames = productInfoInEs.getString("standardOnlyNames");
|
|
|
String colorNames = productInfoInEs.getString("colorNames");
|
|
|
String style = productInfoInEs.getString("style");
|
|
|
String brandName = productInfoInEs.getString("brandName");
|
|
|
|
|
|
String query = productName + "," + standardOnlyNames + "," + colorNames;
|
|
|
String query = standardOnlyNames + "," + style;
|
|
|
if (isInBrand) {
|
|
|
query = brandName + "," + query;
|
|
|
query = brandName + "," + productName + "," + query;
|
|
|
}else{
|
|
|
query = productName.replaceAll(brandName, "") +","+ query;
|
|
|
}
|
|
|
// 2、设置字段权重
|
|
|
MultiMatchQueryBuilder multiMatchQueryBuilder = QueryBuilders.multiMatchQuery(query);
|
...
|
...
|
@@ -323,9 +324,9 @@ public class SearchLikeServiceImpl implements ISearchLikeService { |
|
|
}
|
|
|
// 3、设置匹配度
|
|
|
if (isInBrand) {
|
|
|
multiMatchQueryBuilder.minimumShouldMatch("60%");
|
|
|
multiMatchQueryBuilder.minimumShouldMatch("50%");
|
|
|
} else {
|
|
|
multiMatchQueryBuilder.minimumShouldMatch("75%");
|
|
|
multiMatchQueryBuilder.minimumShouldMatch("70%");
|
|
|
}
|
|
|
// 4、添加个性化打分
|
|
|
QueryBuilder queryBuilder = functionScoreSearchHelper.buildFunctionScoreQueryBuild(multiMatchQueryBuilder, paramMap);
|
...
|
...
|
|