Authored by 胡古飞

修改建议词权重

@@ -10,6 +10,7 @@ import com.yoho.search.base.utils.MD5Util; @@ -10,6 +10,7 @@ import com.yoho.search.base.utils.MD5Util;
10 import com.yoho.search.consumer.index.common.IIndexBuilder; 10 import com.yoho.search.consumer.index.common.IIndexBuilder;
11 import com.yoho.search.consumer.service.base.SuggestionKeywordsService; 11 import com.yoho.search.consumer.service.base.SuggestionKeywordsService;
12 import com.yoho.search.consumer.service.bo.SuggestIndexBO; 12 import com.yoho.search.consumer.service.bo.SuggestIndexBO;
  13 +import com.yoho.search.consumer.suggests.common.KeywordType;
13 import com.yoho.search.dal.model.SuggestionKeywords; 14 import com.yoho.search.dal.model.SuggestionKeywords;
14 15
15 @Component 16 @Component
@@ -22,7 +23,7 @@ public class SuggestIndexBuilder extends IIndexBuilder { @@ -22,7 +23,7 @@ public class SuggestIndexBuilder extends IIndexBuilder {
22 public int getTotalCount() throws Exception { 23 public int getTotalCount() throws Exception {
23 return suggestionKeywordsService.count(); 24 return suggestionKeywordsService.count();
24 } 25 }
25 - 26 +
26 @Override 27 @Override
27 public List<?> getPageLists(int offset, int limit) throws Exception { 28 public List<?> getPageLists(int offset, int limit) throws Exception {
28 List<SuggestionKeywords> guggestionKeywordList = suggestionKeywordsService.getPageLists(offset, limit); 29 List<SuggestionKeywords> guggestionKeywordList = suggestionKeywordsService.getPageLists(offset, limit);
@@ -31,8 +32,8 @@ public class SuggestIndexBuilder extends IIndexBuilder { @@ -31,8 +32,8 @@ public class SuggestIndexBuilder extends IIndexBuilder {
31 if (kw.getCount() == null || kw.getCount() == 0) { 32 if (kw.getCount() == null || kw.getCount() == 0) {
32 continue; 33 continue;
33 } 34 }
34 - int type = -1;  
35 - int weight = -1; 35 + int type = KeywordType.Customized.getType();
  36 + int weight = KeywordType.Customized.getWeightValue();
36 results.add(new SuggestIndexBO(kw.getKeyword(), type, weight, kw.getCount())); 37 results.add(new SuggestIndexBO(kw.getKeyword(), type, weight, kw.getCount()));
37 } 38 }
38 return results; 39 return results;
@@ -5,10 +5,17 @@ package com.yoho.search.consumer.suggests.common; @@ -5,10 +5,17 @@ package com.yoho.search.consumer.suggests.common;
5 */ 5 */
6 public enum KeywordType { 6 public enum KeywordType {
7 7
8 - BrandName(1, 8, SuggestionConstants.BRANDNAME_ENABLED_KEY), ShopName(7, 7, SuggestionConstants.SHOPNAME_ENABLED_KEY), SortName(2, 6, SuggestionConstants.SORTNAME_ENABLED_KEY), ProductNameToken(  
9 - 4, 5, SuggestionConstants.PRODUCTNAME_TOKEN_ENABLED_KEY), ProductName(8, 4, SuggestionConstants.PRODUCTNAME_ENABLED_KEY), ProductKeywordToken(5, 3,  
10 - SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY), BrandKeywordToken(6, 2, SuggestionConstants.BRANDKEYWORD_TOKEN_ENABLED_KEY), HotKeyword(3, 1,  
11 - SuggestionConstants.HOTKEYWORD_ENABLED_KEY), Customized(0, 0); 8 + BrandName(1, 8, SuggestionConstants.BRANDNAME_ENABLED_KEY),
  9 + ShopName(7, 8, SuggestionConstants.SHOPNAME_ENABLED_KEY),
  10 + SortName(2, 8, SuggestionConstants.SORTNAME_ENABLED_KEY),
  11 +
  12 + ProductNameToken(4, 7, SuggestionConstants.PRODUCTNAME_TOKEN_ENABLED_KEY),
  13 + ProductKeywordToken(5, 7,SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY),
  14 + BrandKeywordToken(6, 7, SuggestionConstants.BRANDKEYWORD_TOKEN_ENABLED_KEY),
  15 +
  16 + ProductName(8, 1, SuggestionConstants.PRODUCTNAME_ENABLED_KEY),
  17 + Customized(0, 1),
  18 + HotKeyword(3, 0,SuggestionConstants.HOTKEYWORD_ENABLED_KEY);
12 19
13 private KeywordType(int type, int weightValue) { 20 private KeywordType(int type, int weightValue) {
14 this.type = type; 21 this.type = type;