优化搜索热词管理,增加搜索热词删除
This commit is contained in:
parent
b648aa94b3
commit
ed840a95a1
@ -41,6 +41,13 @@ public interface EsGoodsSearchService {
|
||||
*/
|
||||
void setHotWords(HotWordsDTO hotWords);
|
||||
|
||||
/**
|
||||
* 删除热门关键词
|
||||
*
|
||||
* @param keywords 热词
|
||||
*/
|
||||
void deleteHotWords(String keywords);
|
||||
|
||||
/**
|
||||
* 获取筛选器
|
||||
*
|
||||
|
@ -114,6 +114,16 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), hotWords.getKeywords(), hotWords.getPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除热门关键词
|
||||
*
|
||||
* @param keywords 热词
|
||||
*/
|
||||
@Override
|
||||
public void deleteHotWords(String keywords) {
|
||||
cache.zRemove(CachePrefix.HOT_WORD.getPrefix(), keywords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsGoodsRelatedInfo getSelector(EsGoodsSearchDTO goodsSearch, PageVO pageVo) {
|
||||
NativeSearchQueryBuilder builder = createSearchQueryBuilder(goodsSearch, null);
|
||||
|
@ -8,10 +8,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 管理端,app版本控制器
|
||||
@ -29,16 +26,22 @@ public class HotWordsManagerController {
|
||||
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage getHotWords() {
|
||||
public ResultMessage<Object> getHotWords() {
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@PostMapping
|
||||
public ResultMessage paymentForm(@Validated HotWordsDTO hotWords) {
|
||||
|
||||
public ResultMessage<Object> paymentForm(@Validated HotWordsDTO hotWords) {
|
||||
esGoodsSearchService.setHotWords(hotWords);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
@DeleteMapping("/{words}")
|
||||
public ResultMessage<Object> deleteWords(@PathVariable String words) {
|
||||
esGoodsSearchService.deleteHotWords(words);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user