Authored by Gino Zhang

Merge branch '0310' into zf_suggest_mgr

... ... @@ -2,6 +2,8 @@ package com.yoho.search.consumer.suggests.common;
import com.yoho.search.base.utils.Configuration;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
... ... @@ -22,6 +24,8 @@ public class SuggestionConstants {
"And I", "odm", "rex", "Lee", "pass", "Gold", "Star")
.map(String::toLowerCase).collect(Collectors.toSet());
public static final List<String> IGNORE_BRAND_NAMES = Arrays.asList("+-×÷");
/**
* 返回智能搜索词的数量
*/
... ...
... ... @@ -5,6 +5,7 @@ import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.service.base.BrandService;
import com.yoho.search.consumer.service.base.ProductSortService;
import com.yoho.search.consumer.suggests.common.KeywordType;
import com.yoho.search.consumer.suggests.common.SuggestionConstants;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import com.yoho.search.dal.model.Brand;
... ... @@ -54,7 +55,7 @@ public class BrandWithSortNameSuggestionDiscoverer extends AbstractSuggestionDis
return brandNameSet;
}
List<Integer> brandIdList = brandList.stream().map(Brand::getId).collect(Collectors.toList());
List<Integer> brandIdList = brandList.stream().filter(brand -> !SuggestionConstants.IGNORE_BRAND_NAMES.contains(brand.getBrandName())).map(Brand::getId).collect(Collectors.toList());
SearchParam searchParam = new SearchParam();
searchParam.setSize(0);
... ...
package com.yoho.search.consumer.suggests.discover;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yoho.search.consumer.service.base.BrandService;
import com.yoho.search.consumer.service.base.ProductService;
import com.yoho.search.consumer.service.base.ProductSortService;
import com.yoho.search.consumer.suggests.common.KeywordType;
import com.yoho.search.consumer.suggests.common.SuggestSplitUtils;
import com.yoho.search.consumer.suggests.common.SuggestionConstants;
import com.yoho.search.dal.model.Brand;
import com.yoho.search.dal.model.Product;
import com.yoho.search.dal.model.ProductSort;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscoverer {
... ... @@ -38,7 +34,9 @@ public class ProductNameSuggestionDiscoverer extends AbstractSuggestionDiscovere
super.init();
List<Brand> brands = brandService.getBrandPageLists(0, Integer.MAX_VALUE);
for (Brand brand : brands) {
brandMap.put(brand.getId(), brand);
if(!SuggestionConstants.IGNORE_BRAND_NAMES.contains(brand.getBrandName())){
brandMap.put(brand.getId(), brand);
}
}
List<ProductSort> productSorts = productSortService.getPageLists(0, Integer.MAX_VALUE);
for (ProductSort productSort : productSorts) {
... ...