Authored by 胡古飞

找相似加上工业元素维度

@@ -37,9 +37,10 @@ public class SearchLikeHelper { @@ -37,9 +37,10 @@ public class SearchLikeHelper {
37 public List<SearchFieldBoost> searchFieldBoosts = new ArrayList<SearchFieldBoost>(); 37 public List<SearchFieldBoost> searchFieldBoosts = new ArrayList<SearchFieldBoost>();
38 38
39 private int sortMaxBoost = 1000; 39 private int sortMaxBoost = 1000;
  40 + private int elementsBoost = 700;
  41 + private int standardOnlyNamesBoost = 600;
  42 + private int productNameMaxBoost = 500;
40 private int brandMaxBoost = 400; 43 private int brandMaxBoost = 400;
41 - private int productNameMaxBoost = 600;  
42 - private int standardOnlyNamesBoost = 700;  
43 private int otherBoost = 200; 44 private int otherBoost = 200;
44 45
45 private void addSearchFieldBoost(List<String> searchFields, float maxBoost) { 46 private void addSearchFieldBoost(List<String> searchFields, float maxBoost) {
@@ -68,6 +69,10 @@ public class SearchLikeHelper { @@ -68,6 +69,10 @@ public class SearchLikeHelper {
68 searchFields = Arrays.asList("standardOnlyNames.standardOnlyNames_ansj", "standardOnlyNames.standardOnlyNames_pinyin"); 69 searchFields = Arrays.asList("standardOnlyNames.standardOnlyNames_ansj", "standardOnlyNames.standardOnlyNames_pinyin");
69 this.addSearchFieldBoost(searchFields, standardOnlyNamesBoost); 70 this.addSearchFieldBoost(searchFields, standardOnlyNamesBoost);
70 71
  72 + // 工艺元素权重
  73 + searchFields = Arrays.asList("pattern", "style", "attributeNames");
  74 + this.addSearchFieldBoost(searchFields, elementsBoost);
  75 +
71 // 其他字段权重 76 // 其他字段权重
72 searchFields = Arrays.asList("specialSearchField", "productKeyword", "brandKeyword", "genderS", "searchField_ansj", "searchField"); 77 searchFields = Arrays.asList("specialSearchField", "productKeyword", "brandKeyword", "genderS", "searchField_ansj", "searchField");
73 this.addSearchFieldBoost(searchFields, otherBoost); 78 this.addSearchFieldBoost(searchFields, otherBoost);
@@ -167,7 +172,7 @@ public class SearchLikeHelper { @@ -167,7 +172,7 @@ public class SearchLikeHelper {
167 } 172 }
168 return boolFilter; 173 return boolFilter;
169 } 174 }
170 - 175 +
171 public List<String> getGenderInfo(String gender) { 176 public List<String> getGenderInfo(String gender) {
172 if ("1".equals(gender)) { 177 if ("1".equals(gender)) {
173 return Arrays.asList("1", "3"); 178 return Arrays.asList("1", "3");
@@ -225,9 +225,11 @@ public class SearchLikeServiceImpl implements ISearchLikeService { @@ -225,9 +225,11 @@ public class SearchLikeServiceImpl implements ISearchLikeService {
225 String productName = productInfoInEs.getString("productName"); 225 String productName = productInfoInEs.getString("productName");
226 String standardOnlyNames = productInfoInEs.getString("standardOnlyNames"); 226 String standardOnlyNames = productInfoInEs.getString("standardOnlyNames");
227 String style = productInfoInEs.getString("style"); 227 String style = productInfoInEs.getString("style");
  228 + String pattern = productInfoInEs.getString("pattern");
  229 + String attributeNames = productInfoInEs.getString("attributeNames");
228 String brandName = productInfoInEs.getString("brandName"); 230 String brandName = productInfoInEs.getString("brandName");
229 String productFeatureFactor = productInfoInEs.getString("productFeatureFactor"); 231 String productFeatureFactor = productInfoInEs.getString("productFeatureFactor");
230 - String query = standardOnlyNames + "," + style; 232 + String query = standardOnlyNames + "," + style + "," + pattern + "," + attributeNames;
231 if (isInBrand) { 233 if (isInBrand) {
232 query = brandName + "," + productName + "," + query; 234 query = brandName + "," + productName + "," + query;
233 } else { 235 } else {