热词排序count下标从0开始,所以计算时候进行-1处理
This commit is contained in:
parent
2018457c28
commit
8deaef09d7
@ -104,6 +104,8 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
@Override
|
||||
public List<String> getHotWords(Integer count) {
|
||||
List<String> hotWords = new ArrayList<>();
|
||||
//下表从0开始,所以count-1
|
||||
count = count - 1;
|
||||
Set<DefaultTypedTuple> set = cache.reverseRangeWithScores(CachePrefix.HOT_WORD.getPrefix(), count);
|
||||
for (DefaultTypedTuple defaultTypedTuple : set) {
|
||||
hotWords.add(Objects.requireNonNull(defaultTypedTuple.getValue()).toString());
|
||||
|
@ -30,7 +30,7 @@ public class HotWordsManagerController {
|
||||
@ApiOperation(value = "获取热词")
|
||||
@GetMapping
|
||||
public ResultMessage getHotWords() {
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(99));
|
||||
return ResultUtil.data(esGoodsSearchService.getHotWords(100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置热词")
|
||||
|
Loading…
x
Reference in New Issue
Block a user