|
|
package com.yoho.search.service.restapi;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import com.yoho.search.service.cache.LocalCacheService;
|
|
|
import com.yoho.search.service.personalized.PersonalVectorFeatureSearch;
|
|
|
import com.yoho.search.service.service.SearchKeyWordService;
|
|
|
import com.yoho.search.service.servicenew.IProductListService;
|
|
|
import com.yoho.search.service.vo.KeyWordWithCount;
|
|
|
import com.yoho.search.service.vo.SearchApiResult;
|
|
|
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse.AnalyzeToken;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
...
|
...
|
@@ -12,12 +14,9 @@ import org.springframework.web.bind.annotation.RequestMethod; |
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.yoho.search.service.cache.LocalCacheService;
|
|
|
import com.yoho.search.service.personalized.PersonalVectorFeatureSearch;
|
|
|
import com.yoho.search.service.service.SearchKeyWordService;
|
|
|
import com.yoho.search.service.servicenew.IProductListService;
|
|
|
import com.yoho.search.service.vo.KeyWordWithCount;
|
|
|
import com.yoho.search.service.vo.SearchApiResult;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/tools")
|
...
|
...
|
@@ -50,7 +49,7 @@ public class ToolsController { |
|
|
}
|
|
|
|
|
|
List<String> keywords = new ArrayList<>();
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>)results.get("-1")) {
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>) results.get("-1")) {
|
|
|
keywords.add(keyWordWithCount.getKeyWord());
|
|
|
}
|
|
|
return searchApiResult.setData(keywords);
|
...
|
...
|
@@ -58,6 +57,7 @@ public class ToolsController { |
|
|
|
|
|
/**
|
|
|
* 获取空结果搜索词
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/emptyResultKeywords")
|
...
|
...
|
@@ -72,7 +72,7 @@ public class ToolsController { |
|
|
}
|
|
|
|
|
|
List<String> keywords = new ArrayList<>();
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>)results.get("-1")) {
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>) results.get("-1")) {
|
|
|
keywords.add(keyWordWithCount.getKeyWord());
|
|
|
}
|
|
|
return searchApiResult.setData(keywords);
|
...
|
...
|
@@ -96,13 +96,25 @@ public class ToolsController { |
|
|
}
|
|
|
|
|
|
List<String> keywords = new ArrayList<>();
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>)results.get("-1")) {
|
|
|
for (KeyWordWithCount keyWordWithCount : (List<KeyWordWithCount>) results.get("-1")) {
|
|
|
keywords.add(keyWordWithCount.getKeyWord());
|
|
|
}
|
|
|
return searchApiResult.setData(keywords);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除redis上的key
|
|
|
* @param redisKey
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/deleteRedis")
|
|
|
@ResponseBody
|
|
|
public SearchApiResult deleteRedisKey(@RequestParam String redisKey) {
|
|
|
SearchApiResult searchApiResult = new SearchApiResult();
|
|
|
return searchApiResult.setData(searchKeyWordService.deleteRedisKey(redisKey));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取分词结果
|
|
|
*
|
|
|
* @param request
|
...
|
...
|
@@ -119,8 +131,7 @@ public class ToolsController { |
|
|
/**
|
|
|
* 清除本地缓存
|
|
|
*
|
|
|
* @param request
|
|
|
* 请求
|
|
|
* @param request 请求
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/clearLocalCache")
|
...
|
...
|
|