增加一个展示SKN分词结果的接口,增加清理缓存对象的restful接口
Showing
2 changed files
with
22 additions
and
0 deletions
@@ -48,6 +48,21 @@ public class SearchExplainerController { | @@ -48,6 +48,21 @@ public class SearchExplainerController { | ||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | + @RequestMapping(value = "/tools/clearExplainCachedData") | ||
52 | + @ResponseBody | ||
53 | + public Map<String, Object> clearExplainCachedData(HttpServletRequest request) { | ||
54 | + try { | ||
55 | + searchExplainerService.clearCachedData(); | ||
56 | + Map<String, Object> map = new HashMap<>(); | ||
57 | + map.put("code", "200"); | ||
58 | + map.put("message", "succeed"); | ||
59 | + return map; | ||
60 | + } catch (Throwable t) { | ||
61 | + logger.error(t.getMessage(), t); | ||
62 | + return errorResult(t.getMessage()); | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
51 | @RequestMapping(value = "/tools/tokens") | 66 | @RequestMapping(value = "/tools/tokens") |
52 | @ResponseBody | 67 | @ResponseBody |
53 | public Map<String, Object> getTokens(@RequestParam String skn) { | 68 | public Map<String, Object> getTokens(@RequestParam String skn) { |
@@ -107,6 +107,13 @@ public class SearchExplainerService { | @@ -107,6 +107,13 @@ public class SearchExplainerService { | ||
107 | return esField.getFieldName(); | 107 | return esField.getFieldName(); |
108 | } | 108 | } |
109 | 109 | ||
110 | + public void clearCachedData(){ | ||
111 | + this.localMutilFields = null; | ||
112 | + this.localMutilFieldWithBoostList = null; | ||
113 | + this.localCopiedFieldMap = null; | ||
114 | + this.localFieldDescMap = null; | ||
115 | + } | ||
116 | + | ||
110 | public Map<String, Object> show(Map<String, String> paramMap) throws Exception { | 117 | public Map<String, Object> show(Map<String, String> paramMap) throws Exception { |
111 | Map<String, Object> map = new LinkedHashMap<>(); | 118 | Map<String, Object> map = new LinkedHashMap<>(); |
112 | String skn = paramMap.get("skn"); | 119 | String skn = paramMap.get("skn"); |
-
Please register or login to post a comment