...
|
...
|
@@ -5,68 +5,72 @@ package com.yoho.search.consumer.suggests.common; |
|
|
*/
|
|
|
public enum KeywordType {
|
|
|
|
|
|
BrandName(1, 8, SuggestionConstants.BRANDNAME_ENABLED_KEY),
|
|
|
ShopName(7, 8, SuggestionConstants.SHOPNAME_ENABLED_KEY),
|
|
|
SortName(2, 8, SuggestionConstants.SORTNAME_ENABLED_KEY),
|
|
|
BrandName(1, 8, SuggestionConstants.BRANDNAME_ENABLED_KEY),
|
|
|
ShopName(7, 8, SuggestionConstants.SHOPNAME_ENABLED_KEY),
|
|
|
SortName(2, 8, SuggestionConstants.SORTNAME_ENABLED_KEY),
|
|
|
|
|
|
BrandWithSortName(11, 7, SuggestionConstants.BRANDWITHSORTNAME_ENABLED_KEY),
|
|
|
TblBrandName(9, 7, SuggestionConstants.BRANDNAME_ENABLED_KEY),
|
|
|
TblSortName(10, 7, SuggestionConstants.SORTNAME_ENABLED_KEY),
|
|
|
|
|
|
ProductNameToken(4, 6, SuggestionConstants.PRODUCTNAME_TOKEN_ENABLED_KEY),
|
|
|
ProductKeywordToken(5, 6,SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY),
|
|
|
BrandKeywordToken(6, 6, SuggestionConstants.BRANDKEYWORD_TOKEN_ENABLED_KEY),
|
|
|
BrandWithSortName(11, 7, SuggestionConstants.BRANDWITHSORTNAME_ENABLED_KEY),
|
|
|
TblBrandName(9, 7, SuggestionConstants.BRANDNAME_ENABLED_KEY),
|
|
|
TblSortName(10, 7, SuggestionConstants.SORTNAME_ENABLED_KEY),
|
|
|
|
|
|
StyleName(13, 4, SuggestionConstants.STYLENAME_ENABLED_KEY),
|
|
|
ParameterMake(12, 3, SuggestionConstants.PARAMETERMAKE_ENABLED_KEY),
|
|
|
StyleName(13, 7, SuggestionConstants.STYLENAME_ENABLED_KEY),
|
|
|
ParameterMake(12, 7, SuggestionConstants.PARAMETERMAKE_ENABLED_KEY),
|
|
|
|
|
|
ProductName(8, 1, SuggestionConstants.PRODUCTNAME_ENABLED_KEY),
|
|
|
Customized(0, 1),
|
|
|
HotKeyword(3, 0,SuggestionConstants.HOTKEYWORD_ENABLED_KEY);
|
|
|
ProductNameToken(4, 6, SuggestionConstants.PRODUCTNAME_TOKEN_ENABLED_KEY),
|
|
|
ProductKeywordToken(5, 6, SuggestionConstants.PRODUCTKEYWORD_TOKEN_ENABLED_KEY),
|
|
|
BrandKeywordToken(6, 6, SuggestionConstants.BRANDKEYWORD_TOKEN_ENABLED_KEY),
|
|
|
|
|
|
private KeywordType(int type, int weightValue) {
|
|
|
this.type = type;
|
|
|
this.weightValue = weightValue;
|
|
|
}
|
|
|
ProductName(8, 1, SuggestionConstants.PRODUCTNAME_ENABLED_KEY),
|
|
|
Customized(0, 1),
|
|
|
HotKeyword(3, 0, SuggestionConstants.HOTKEYWORD_ENABLED_KEY);
|
|
|
|
|
|
private KeywordType(int type, int weightValue, String globleEnabledKey) {
|
|
|
this(type, weightValue);
|
|
|
this.globleEnabledKey = globleEnabledKey;
|
|
|
}
|
|
|
private KeywordType(int type, int weightValue) {
|
|
|
this.type = type;
|
|
|
this.weightValue = weightValue;
|
|
|
}
|
|
|
|
|
|
private int type;
|
|
|
private int weightValue;
|
|
|
private String globleEnabledKey;
|
|
|
private KeywordType(int type, int weightValue, String globleEnabledKey) {
|
|
|
this(type, weightValue);
|
|
|
this.globleEnabledKey = globleEnabledKey;
|
|
|
}
|
|
|
|
|
|
public int getType() {
|
|
|
return this.type;
|
|
|
}
|
|
|
private int type;
|
|
|
private int weightValue;
|
|
|
private String globleEnabledKey;
|
|
|
|
|
|
public String getGlobleEnabledKey() {
|
|
|
return this.globleEnabledKey;
|
|
|
}
|
|
|
public int getType() {
|
|
|
return this.type;
|
|
|
}
|
|
|
|
|
|
public int getWeightValue() {
|
|
|
return this.weightValue;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 值越大,越排在前面
|
|
|
*
|
|
|
* @param other
|
|
|
* @return
|
|
|
*/
|
|
|
public int compare(KeywordType other) {
|
|
|
return (this.weightValue - other.getWeightValue()) * (-1);
|
|
|
}
|
|
|
|
|
|
public static int getWeightValueByType(int type){
|
|
|
for (KeywordType keywordType : KeywordType.values()) {
|
|
|
if(keywordType.getType()==type){
|
|
|
return keywordType.getWeightValue();
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
public String getGlobleEnabledKey() {
|
|
|
return this.globleEnabledKey;
|
|
|
}
|
|
|
|
|
|
public int getWeightValue() {
|
|
|
return this.weightValue;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 值越大,越排在前面
|
|
|
*
|
|
|
* @param other
|
|
|
* @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) {
|
|
|
for (KeywordType keywordType : KeywordType.values()) {
|
|
|
if (keywordType.getType() == type) {
|
|
|
return keywordType.getWeightValue();
|
|
|
}
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|