Authored by Gino Zhang

增加一个打印动态参数值的API

... ... @@ -2,6 +2,7 @@ package com.yoho.search.service.restapi;
import com.yoho.search.service.cache.LocalCacheService;
import com.yoho.search.service.personalized.PersonalVectorFeatureSearch;
import com.yoho.search.service.service.SearchDynamicConfigService;
import com.yoho.search.service.service.SearchKeyWordService;
import com.yoho.search.service.servicenew.IProductListService;
import com.yoho.search.service.vo.KeyWordWithCount;
... ... @@ -9,12 +10,14 @@ 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;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
... ... @@ -31,6 +34,9 @@ public class ToolsController {
@Autowired
private IProductListService productListService;
@Autowired
private SearchDynamicConfigService searchDynamicConfigService;
/**
* 获取热搜词结果
*
... ... @@ -104,6 +110,7 @@ public class ToolsController {
/**
* 删除redis上的key
*
* @param redisKey
* @return
*/
... ... @@ -141,6 +148,23 @@ public class ToolsController {
return new SearchApiResult().setMessage("清除本地缓存成功");
}
@RequestMapping(value = "/dynamicParameterValue")
@ResponseBody
public Map<String, Object> dynamicParameterValue(String key) {
Map<String, Object> rtnMap = new HashMap<String, Object>();
try {
Assert.notNull(key);
rtnMap.put("code", 200);
rtnMap.put("value", searchDynamicConfigService.getDynamicParameterValue(key));
} catch (Exception e) {
rtnMap.put("code", 400);
rtnMap.put("msg", e.getMessage());
}
return rtnMap;
}
@RequestMapping(method = RequestMethod.GET, value = "/calVectorFeature")
@ResponseBody
public SearchApiResult calVectorFeature(@RequestParam String uid, @RequestParam String skns, @RequestParam String version) throws Exception {
... ...
... ... @@ -114,4 +114,11 @@ public class SearchDynamicConfigService {
public boolean isSearchSuggestionFromConversionOpen(){
return configReader.getBoolean("search.suggestion.tips.conversion.open", true);
}
/**
* 关于API查看动态参数值
*/
public String getDynamicParameterValue(String key){
return configReader.getString(key, "DEFAULT");
}
}
... ...