Authored by Gino Zhang

suggestTips支持默认的配置【潮流,时尚,休闲】

... ... @@ -4,15 +4,9 @@ import com.yoho.core.config.ConfigReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class SearchDynamicConfigService {
// 返回智能搜索词的数量
private static final int SMART_SUGGESTION_TERM_COUNT = 3;
@Autowired
private ConfigReader configReader;
... ... @@ -120,18 +114,4 @@ public class SearchDynamicConfigService {
public boolean isSearchSuggestionFromConversionOpen(){
return configReader.getBoolean("search.suggestion.tips.conversion.open", true);
}
public List<String> defaultSuggestTips() {
List<String> results = new ArrayList<>(SMART_SUGGESTION_TERM_COUNT);
String values = configReader.getString("search.suggestion.tips.conversion.default", "潮流,运动,休闲");
for (String item : values.split(",")) {
results.add(item);
if (results.size() == SMART_SUGGESTION_TERM_COUNT) {
return results;
}
}
return results;
}
}
... ...
... ... @@ -55,6 +55,8 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
// 返回智能搜索词限制关联商品数量限制
private static final int SMART_SUGGESTION_COUNT_LIMIT = 20;
private static final List<String> DEFAULT_SUGGEST_TIPS = Arrays.asList("潮流","时尚","休闲");
@Autowired
private SearchCommonService searchCommonService;
@Autowired
... ... @@ -451,7 +453,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
private JSONObject defaultSuggestTips() {
JSONObject defSuggestResult = new JSONObject();
defSuggestResult.put("terms_suggestion", searchDynamicConfigService.defaultSuggestTips());
defSuggestResult.put("terms_suggestion", DEFAULT_SUGGEST_TIPS);
return defSuggestResult;
}
... ...
... ... @@ -33,5 +33,4 @@ search.dynamic.rule.open=false
#better search suggestion
search.suggestion.tips.open=true
search.suggestion.tips.conversion.open=true
search.suggestion.tips.conversion.default=潮流,运动,休闲
\ No newline at end of file
search.suggestion.tips.conversion.open=true
\ No newline at end of file
... ...