Authored by hugufei

优化suggest接口

@@ -57,7 +57,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl @@ -57,7 +57,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
57 } 57 }
58 58
59 @Override 59 @Override
60 - @SearchCacheAble(cacheInMinute = 60, cacheName = "SUGGEST", includeParams = { "query", "app_type", "contain_global", "is_encode" }, returnClass = SuggestApiResult.class) 60 + @SearchCacheAble(cacheInMinute = 60, cacheName = "SUGGEST", includeParams = {"query", "app_type", "contain_global", "is_encode"}, returnClass = SuggestApiResult.class)
61 public SuggestApiResult suggest(Map<String, String> paramMap) { 61 public SuggestApiResult suggest(Map<String, String> paramMap) {
62 try { 62 try {
63 logger.info("[func=suggest][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis()); 63 logger.info("[func=suggest][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());
@@ -171,27 +171,30 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl @@ -171,27 +171,30 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
171 /** 171 /**
172 * 根据搜索条件判断使用到的suggest索引的count字段名。 172 * 根据搜索条件判断使用到的suggest索引的count字段名。
173 * 173 *
174 - * @param paramMap  
175 - * 搜索条件 174 + * @param paramMap 搜索条件
176 * @return count字段名 175 * @return count字段名
177 */ 176 */
178 @Override 177 @Override
179 public String getCountField(Map<String, String> paramMap) { 178 public String getCountField(Map<String, String> paramMap) {
180 // suggest 支持PC、APP、BLK走不同的count字段 字段同SuggestIndexBO里保持一直 179 // suggest 支持PC、APP、BLK走不同的count字段 字段同SuggestIndexBO里保持一直
  180 +// if (paramMap.containsKey(SUGGEST_PARAM_APPTYPE) && "1".equals(paramMap.get(SUGGEST_PARAM_APPTYPE))) {
  181 +// return "countForBlk";
  182 +// } else if (paramMap.containsKey(SUGGEST_PARAM_GLOBAL) && "Y".equals(paramMap.get(SUGGEST_PARAM_GLOBAL))) {
  183 +// return "countForApp";
  184 +// } else {
  185 +// return "count";
  186 +// }
181 if (paramMap.containsKey(SUGGEST_PARAM_APPTYPE) && "1".equals(paramMap.get(SUGGEST_PARAM_APPTYPE))) { 187 if (paramMap.containsKey(SUGGEST_PARAM_APPTYPE) && "1".equals(paramMap.get(SUGGEST_PARAM_APPTYPE))) {
182 return "countForBlk"; 188 return "countForBlk";
183 - } else if (paramMap.containsKey(SUGGEST_PARAM_GLOBAL) && "Y".equals(paramMap.get(SUGGEST_PARAM_GLOBAL))) {  
184 - return "countForApp";  
185 } else { 189 } else {
186 - return "count"; 190 + return "countForApp";
187 } 191 }
188 } 192 }
189 193
190 /** 194 /**
191 * 到suggest索引进行拼写纠错处理。 195 * 到suggest索引进行拼写纠错处理。
192 * 196 *
193 - * @param keyword  
194 - * 用户输入的关键词 197 + * @param keyword 用户输入的关键词
195 * @return 纠错后的关键词。 198 * @return 纠错后的关键词。
196 */ 199 */
197 @Override 200 @Override
@@ -209,8 +212,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl @@ -209,8 +212,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
209 /** 212 /**
210 * 根据关键词查询suggest索引 213 * 根据关键词查询suggest索引
211 * 214 *
212 - * @param paramMap  
213 - * 查询参数 215 + * @param paramMap 查询参数
214 * @return 满足查询要求的建议词 216 * @return 满足查询要求的建议词
215 */ 217 */
216 @Override 218 @Override