Authored by hugufei

优化suggest接口

... ... @@ -57,7 +57,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
}
@Override
@SearchCacheAble(cacheInMinute = 60, cacheName = "SUGGEST", includeParams = { "query", "app_type", "contain_global", "is_encode" }, returnClass = SuggestApiResult.class)
@SearchCacheAble(cacheInMinute = 60, cacheName = "SUGGEST", includeParams = {"query", "app_type", "contain_global", "is_encode"}, returnClass = SuggestApiResult.class)
public SuggestApiResult suggest(Map<String, String> paramMap) {
try {
logger.info("[func=suggest][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());
... ... @@ -171,27 +171,30 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
/**
* 根据搜索条件判断使用到的suggest索引的count字段名。
*
* @param paramMap
* 搜索条件
* @param paramMap 搜索条件
* @return count字段名
*/
@Override
public String getCountField(Map<String, String> paramMap) {
// suggest 支持PC、APP、BLK走不同的count字段 字段同SuggestIndexBO里保持一直
// if (paramMap.containsKey(SUGGEST_PARAM_APPTYPE) && "1".equals(paramMap.get(SUGGEST_PARAM_APPTYPE))) {
// return "countForBlk";
// } else if (paramMap.containsKey(SUGGEST_PARAM_GLOBAL) && "Y".equals(paramMap.get(SUGGEST_PARAM_GLOBAL))) {
// return "countForApp";
// } else {
// return "count";
// }
if (paramMap.containsKey(SUGGEST_PARAM_APPTYPE) && "1".equals(paramMap.get(SUGGEST_PARAM_APPTYPE))) {
return "countForBlk";
} else if (paramMap.containsKey(SUGGEST_PARAM_GLOBAL) && "Y".equals(paramMap.get(SUGGEST_PARAM_GLOBAL))) {
return "countForApp";
} else {
return "count";
return "countForApp";
}
}
/**
* 到suggest索引进行拼写纠错处理。
*
* @param keyword
* 用户输入的关键词
* @param keyword 用户输入的关键词
* @return 纠错后的关键词。
*/
@Override
... ... @@ -209,8 +212,7 @@ public class SuggestServiceImpl implements ISuggestService, ApplicationEventPubl
/**
* 根据关键词查询suggest索引
*
* @param paramMap
* 查询参数
* @param paramMap 查询参数
* @return 满足查询要求的建议词
*/
@Override
... ...