Authored by Gino Zhang

增加一个展示SKN分词结果的接口,增加清理缓存对象的restful接口

... ... @@ -48,6 +48,21 @@ public class SearchExplainerController {
}
}
@RequestMapping(value = "/tools/clearExplainCachedData")
@ResponseBody
public Map<String, Object> clearExplainCachedData(HttpServletRequest request) {
try {
searchExplainerService.clearCachedData();
Map<String, Object> map = new HashMap<>();
map.put("code", "200");
map.put("message", "succeed");
return map;
} catch (Throwable t) {
logger.error(t.getMessage(), t);
return errorResult(t.getMessage());
}
}
@RequestMapping(value = "/tools/tokens")
@ResponseBody
public Map<String, Object> getTokens(@RequestParam String skn) {
... ...
... ... @@ -107,6 +107,13 @@ public class SearchExplainerService {
return esField.getFieldName();
}
public void clearCachedData(){
this.localMutilFields = null;
this.localMutilFieldWithBoostList = null;
this.localCopiedFieldMap = null;
this.localFieldDescMap = null;
}
public Map<String, Object> show(Map<String, String> paramMap) throws Exception {
Map<String, Object> map = new LinkedHashMap<>();
String skn = paramMap.get("skn");
... ...