Authored by hugufei

修复nested字段的搜索

... ... @@ -63,7 +63,7 @@ public class SearchLikeHelper {
@PostConstruct
void init() {
// 品类权重
List<String> searchFields = Arrays.asList("smallSort", "smallSort.smallSort_pinyin", "middleSort", "middleSort.middleSort_pinyin", "maxSort", "maxSort.maxSort_pinyin");
List<String> searchFields = Arrays.asList("smallSort.smallSort", "smallSort.smallSort_pinyin", "middleSort.middleSort", "middleSort.middleSort_pinyin", "maxSort.maxSort", "maxSort.maxSort_pinyin");
this.addSearchFieldBoost(searchFields, sortMaxBoost);
// 商品名称权重
... ... @@ -71,7 +71,7 @@ public class SearchLikeHelper {
this.addSearchFieldBoost(searchFields, productNameMaxBoost);
// 品牌权重
searchFields = Arrays.asList("brandName.brandName_lowercase", "brandName", "brandNameCn", "brandNameCn.brandNameCn_pinyin", "brandDomain", "brandNameEn");
searchFields = Arrays.asList("brandName.brandName_lowercase", "brandName.brandName", "brandNameCn.brandNameCn", "brandNameCn.brandNameCn_pinyin", "brandDomain", "brandNameEn");
this.addSearchFieldBoost(searchFields, brandMaxBoost);
// 规则权重
... ...
... ... @@ -92,9 +92,9 @@ public class ShopListServiceImpl implements IShopListService {
MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
queryBuilder.operator(Operator.OR);
StringBuilder searchField = new StringBuilder();
searchField.append("brandName.brandName_lowercase^4000,brandName^900").append(',');
searchField.append("shopName.shopName_lowercase^4000,shopName^900").append(',');
searchField.append("brandNameCn^850,brandNameCn.brandNameCn_pinyin^850").append(',');
searchField.append("brandName.brandName_lowercase^4000,brandName.brandName^900").append(',');
searchField.append("shopName.shopName_lowercase^4000,shopName.shopName^900").append(',');
searchField.append("brandNameCn.brandNameCn^850,brandNameCn.brandNameCn_pinyin^850").append(',');
searchField.append("brandNameEn^800,brandDomain^700");
String[] fields = searchField.toString().split(",");
for (String field : fields) {
... ...
... ... @@ -30,7 +30,7 @@ search.index.translog.flush_threshold_ops=10000
#search
search.minimum.should.match=3<90%
search.operator=or
search.default.field=brandName.brandName_lowercase^4000,smallSort^1000,smallSort.smallSort_pinyin^1000,middleSort^950,middleSort.middleSort_pinyin^950,maxSort^900,maxSort.maxSort_pinyin^900,brandName^900,brandNameCn^850,brandNameCn.brandNameCn_pinyin^850,brandNameEn^800,brandDomain^800,specialSearchField^700,specialSearchFieldPrice^700,specialSearchFieldVideo^700,productName.productName_ansj^300,standardOnlyNames.standardOnlyNames_pinyin^250,standardOnlyNames.standardOnlyNames_ansj^250,productKeyword^50,brandKeyword^30,genderS^20,salesPhrase^50,marketPhrase^50,searchField_ansj^10,promotionTitles^5,searchField,productSkn.productSkn_ansj,productSkn.productSkn_ik
search.default.field=brandName.brandName_lowercase^4000,shopName.shopName_lowercase^4000,smallSort.smallSort^1000,smallSort.smallSort_pinyin^1000,middleSort.middleSort^950,middleSort.middleSort_pinyin^950,maxSort.maxSort^900,maxSort.maxSort_pinyin^900,brandName.brandName^900,brandNameCn.brandNameCn^850,brandNameCn.brandNameCn_pinyin^850,brandNameEn^800,brandDomain^800,shopName.shopName^900,specialSearchField^700,specialSearchFieldPrice^700,specialSearchFieldVideo^700,productName.productName_ansj^300,standardOnlyNames.standardOnlyNames_pinyin^250,standardOnlyNames.standardOnlyNames_ansj^250,productKeyword^50,salesPhrase^50,marketPhrase^50,brandKeyword^30,genderS^20,searchField_ansj^10,promotionTitles^5,searchField,productSkn.productSkn_ansj,productSkn.productSkn_ik
search.script.score=_score+doc['sortWeight'].value*0.003+(100-doc['breakingRate'].value)/100 * doc['salesWithDateDiff'].value/pow((now-doc['shelveTime'].value)/3600+2,1.8)
search.script.lang=groovy
... ...
... ... @@ -30,7 +30,7 @@ search.index.translog.flush_threshold_ops=${search.index.translog.flush_threshol
#search
search.minimum.should.match=3<90%
search.operator=or
search.default.field=brandName.brandName_lowercase^4000,smallSort^1000,smallSort.smallSort_pinyin^1000,middleSort^950,middleSort.middleSort_pinyin^950,maxSort^900,maxSort.maxSort_pinyin^900,brandName^900,brandNameCn^850,brandNameCn.brandNameCn_pinyin^850,brandNameEn^800,brandDomain^800,specialSearchField^700,specialSearchFieldPrice^700,specialSearchFieldVideo^700,productName.productName_ansj^300,standardOnlyNames.standardOnlyNames_pinyin^250,standardOnlyNames.standardOnlyNames_ansj^250,productKeyword^50,brandKeyword^30,genderS^20,salesPhrase^50,marketPhrase^50,searchField_ansj^10,promotionTitles^5,searchField,productSkn.productSkn_ansj,productSkn.productSkn_ik
search.default.field=brandName.brandName_lowercase^4000,shopName.shopName_lowercase^4000,smallSort.smallSort^1000,smallSort.smallSort_pinyin^1000,middleSort.middleSort^950,middleSort.middleSort_pinyin^950,maxSort.maxSort^900,maxSort.maxSort_pinyin^900,brandName.brandName^900,brandNameCn.brandNameCn^850,brandNameCn.brandNameCn_pinyin^850,brandNameEn^800,brandDomain^800,shopName.shopName^900,specialSearchField^700,specialSearchFieldPrice^700,specialSearchFieldVideo^700,productName.productName_ansj^300,standardOnlyNames.standardOnlyNames_pinyin^250,standardOnlyNames.standardOnlyNames_ansj^250,productKeyword^50,salesPhrase^50,marketPhrase^50,brandKeyword^30,genderS^20,searchField_ansj^10,promotionTitles^5,searchField,productSkn.productSkn_ansj,productSkn.productSkn_ik
search.script.score=_score+doc['sortWeight'].value*0.003+(100-doc['breakingRate'].value)/100 * doc['salesWithDateDiff'].value/pow((now-doc['shelveTime'].value)/3600+2,1.8)
search.script.lang=groovy
... ...