热词自定义分数线功能完善
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package cn.lili.modules.search.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 搜索热词
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-07-26 15:46
|
||||
*/
|
||||
@Data
|
||||
public class HotWordsDTO {
|
||||
|
||||
@NotBlank(message = "搜索热词不能为空")
|
||||
private String keywords;
|
||||
|
||||
@NotNull(message = "分数不能为空")
|
||||
private Integer point;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
|
||||
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.util.List;
|
||||
@@ -36,11 +37,9 @@ public interface EsGoodsSearchService {
|
||||
|
||||
/**
|
||||
* 设置热门关键词
|
||||
*
|
||||
* @param words 关键词
|
||||
* @param point 赋予分数
|
||||
* @param hotWords 热词分数
|
||||
*/
|
||||
void setHotWords(String words, Integer point);
|
||||
void setHotWords(HotWordsDTO hotWords);
|
||||
|
||||
/**
|
||||
* 获取筛选器
|
||||
|
||||
@@ -15,6 +15,7 @@ import cn.lili.modules.goods.service.CategoryService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsRelatedInfo;
|
||||
import cn.lili.modules.search.entity.dto.EsGoodsSearchDTO;
|
||||
import cn.lili.modules.search.entity.dto.HotWordsDTO;
|
||||
import cn.lili.modules.search.entity.dto.ParamOptions;
|
||||
import cn.lili.modules.search.entity.dto.SelectorOptions;
|
||||
import cn.lili.modules.search.repository.EsGoodsIndexRepository;
|
||||
@@ -111,8 +112,8 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHotWords(String words, Integer point) {
|
||||
cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), words, point);
|
||||
public void setHotWords(HotWordsDTO hotWords) {
|
||||
cache.incrementScore(CachePrefix.HOT_WORD.getPrefix(), hotWords.getKeywords(), hotWords.getPoint());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user