...
|
...
|
@@ -13,6 +13,12 @@ public class RecallConfigService { |
|
|
@Autowired
|
|
|
private RecallConfigServiceCommon recallConfigServiceCommon;
|
|
|
|
|
|
private int legallValue(int value, int min, int max) {
|
|
|
value = Math.min(value, max);
|
|
|
value = Math.max(value, min);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取推荐的品类品牌的配置
|
|
|
*
|
...
|
...
|
@@ -20,7 +26,8 @@ public class RecallConfigService { |
|
|
* @return
|
|
|
*/
|
|
|
public int getRecSortBrandCount(int pageId) {
|
|
|
return recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.REC_S_B_COUNT, 12);
|
|
|
int value = recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.REC_S_B_COUNT, 12);
|
|
|
return this.legallValue(value, 0, 30);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -30,7 +37,8 @@ public class RecallConfigService { |
|
|
* @return
|
|
|
*/
|
|
|
public int getVectorW2vSortBrandCount(int pageId) {
|
|
|
return recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.VEC_W2V_S_B_COUNT, 12);
|
|
|
int value = recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.VEC_W2V_S_B_COUNT, 12);
|
|
|
return this.legallValue(value, 0, 30);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -40,7 +48,8 @@ public class RecallConfigService { |
|
|
* @return
|
|
|
*/
|
|
|
public int getVectorRNNSortBrandCount(int pageId) {
|
|
|
return recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.VEC_RNN_S_B_COUNT, 0);
|
|
|
int value = recallConfigServiceCommon.queryConfigSize(pageId, RecallConfigConstants.VEC_RNN_S_B_COUNT, 0);
|
|
|
return this.legallValue(value, 0, 30);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -52,7 +61,8 @@ public class RecallConfigService { |
|
|
*/
|
|
|
public int queryStrategyConfigSize(int pageId, StrategyEnum strategyEnum) {
|
|
|
String configKey = getStrategyConfigKey(strategyEnum);
|
|
|
return recallConfigServiceCommon.queryConfigSize(pageId, configKey, 0);
|
|
|
int value = recallConfigServiceCommon.queryConfigSize(pageId, configKey, 0);
|
|
|
return this.legallValue(value, 0, 100);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -65,9 +75,7 @@ public class RecallConfigService { |
|
|
public int queryStrategyConfigInterval(int pageId, StrategyEnum strategyEnum) {
|
|
|
String configKey = getStrategyConfigKey(strategyEnum);
|
|
|
int interval = recallConfigServiceCommon.queryConfigInterval(pageId, configKey, 10);
|
|
|
interval = Math.max(interval, 2);
|
|
|
interval = Math.min(interval, 40);
|
|
|
return interval;
|
|
|
return this.legallValue(interval, 2, 40);
|
|
|
}
|
|
|
|
|
|
private String getStrategyConfigKey(StrategyEnum strategyEnum) {
|
...
|
...
|
|