Authored by Gino Zhang

调整suggest_word的插入顺序

... ... @@ -13,16 +13,16 @@ public enum KeywordType {
TblBrandName(9, 7, SuggestionConstants.BRANDNAME_ENABLED_KEY),
TblSortName(10, 7, SuggestionConstants.SORTNAME_ENABLED_KEY),
StyleName(13, 7, SuggestionConstants.STYLENAME_ENABLED_KEY),
ParameterMake(12, 7, SuggestionConstants.PARAMETERMAKE_ENABLED_KEY),
ProductNameToken(4, 6, SuggestionConstants.PRODUCTNAME_TOKEN_ENABLED_KEY),
ProductKeywordToken(5, 6,SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY),
ProductKeywordToken(5, 6, SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY),
BrandKeywordToken(6, 6, SuggestionConstants.BRANDKEYWORD_TOKEN_ENABLED_KEY),
StyleName(13, 4, SuggestionConstants.STYLENAME_ENABLED_KEY),
ParameterMake(12, 3, SuggestionConstants.PARAMETERMAKE_ENABLED_KEY),
ProductName(8, 1, SuggestionConstants.PRODUCTNAME_ENABLED_KEY),
Customized(0, 1),
HotKeyword(3, 0,SuggestionConstants.HOTKEYWORD_ENABLED_KEY);
HotKeyword(3, 0, SuggestionConstants.HOTKEYWORD_ENABLED_KEY);
private KeywordType(int type, int weightValue) {
this.type = type;
... ... @@ -57,12 +57,16 @@ public enum KeywordType {
* @return
*/
public int compare(KeywordType other) {
if (this.weightValue != other.getWeightValue()) {
return (this.weightValue - other.getWeightValue()) * (-1);
} else {
return (this.type - other.getType()) * (-1);
}
}
public static int getWeightValueByType(int type){
public static int getWeightValueByType(int type) {
for (KeywordType keywordType : KeywordType.values()) {
if(keywordType.getType()==type){
if (keywordType.getType() == type) {
return keywordType.getWeightValue();
}
}
... ...