suggestTips支持默认的配置【潮流,时尚,休闲】
Showing
3 changed files
with
3 additions
and
22 deletions
@@ -4,15 +4,9 @@ import com.yoho.core.config.ConfigReader; | @@ -4,15 +4,9 @@ import com.yoho.core.config.ConfigReader; | ||
4 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
5 | import org.springframework.stereotype.Service; | 5 | import org.springframework.stereotype.Service; |
6 | 6 | ||
7 | -import java.util.ArrayList; | ||
8 | -import java.util.List; | ||
9 | - | ||
10 | @Service | 7 | @Service |
11 | public class SearchDynamicConfigService { | 8 | public class SearchDynamicConfigService { |
12 | 9 | ||
13 | - // 返回智能搜索词的数量 | ||
14 | - private static final int SMART_SUGGESTION_TERM_COUNT = 3; | ||
15 | - | ||
16 | @Autowired | 10 | @Autowired |
17 | private ConfigReader configReader; | 11 | private ConfigReader configReader; |
18 | 12 | ||
@@ -120,18 +114,4 @@ public class SearchDynamicConfigService { | @@ -120,18 +114,4 @@ public class SearchDynamicConfigService { | ||
120 | public boolean isSearchSuggestionFromConversionOpen(){ | 114 | public boolean isSearchSuggestionFromConversionOpen(){ |
121 | return configReader.getBoolean("search.suggestion.tips.conversion.open", true); | 115 | return configReader.getBoolean("search.suggestion.tips.conversion.open", true); |
122 | } | 116 | } |
123 | - | ||
124 | - public List<String> defaultSuggestTips() { | ||
125 | - List<String> results = new ArrayList<>(SMART_SUGGESTION_TERM_COUNT); | ||
126 | - String values = configReader.getString("search.suggestion.tips.conversion.default", "潮流,运动,休闲"); | ||
127 | - | ||
128 | - for (String item : values.split(",")) { | ||
129 | - results.add(item); | ||
130 | - if (results.size() == SMART_SUGGESTION_TERM_COUNT) { | ||
131 | - return results; | ||
132 | - } | ||
133 | - } | ||
134 | - | ||
135 | - return results; | ||
136 | - } | ||
137 | } | 117 | } |
@@ -55,6 +55,8 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | @@ -55,6 +55,8 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | ||
55 | // 返回智能搜索词限制关联商品数量限制 | 55 | // 返回智能搜索词限制关联商品数量限制 |
56 | private static final int SMART_SUGGESTION_COUNT_LIMIT = 20; | 56 | private static final int SMART_SUGGESTION_COUNT_LIMIT = 20; |
57 | 57 | ||
58 | + private static final List<String> DEFAULT_SUGGEST_TIPS = Arrays.asList("潮流","时尚","休闲"); | ||
59 | + | ||
58 | @Autowired | 60 | @Autowired |
59 | private SearchCommonService searchCommonService; | 61 | private SearchCommonService searchCommonService; |
60 | @Autowired | 62 | @Autowired |
@@ -451,7 +453,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | @@ -451,7 +453,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl | ||
451 | 453 | ||
452 | private JSONObject defaultSuggestTips() { | 454 | private JSONObject defaultSuggestTips() { |
453 | JSONObject defSuggestResult = new JSONObject(); | 455 | JSONObject defSuggestResult = new JSONObject(); |
454 | - defSuggestResult.put("terms_suggestion", searchDynamicConfigService.defaultSuggestTips()); | 456 | + defSuggestResult.put("terms_suggestion", DEFAULT_SUGGEST_TIPS); |
455 | return defSuggestResult; | 457 | return defSuggestResult; |
456 | } | 458 | } |
457 | 459 |
@@ -34,4 +34,3 @@ search.dynamic.rule.open=false | @@ -34,4 +34,3 @@ search.dynamic.rule.open=false | ||
34 | #better search suggestion | 34 | #better search suggestion |
35 | search.suggestion.tips.open=true | 35 | search.suggestion.tips.open=true |
36 | search.suggestion.tips.conversion.open=true | 36 | search.suggestion.tips.conversion.open=true |
37 | -search.suggestion.tips.conversion.default=潮流,运动,休闲 |
-
Please register or login to post a comment