优化商品搜索(增加商品基础分数,同goodsId递减。增加销量分数占比)

This commit is contained in:
paulGao
2021-11-08 16:20:44 +08:00
parent c4feaa1546
commit d877a24dec
3 changed files with 6 additions and 6 deletions

View File

@@ -262,8 +262,8 @@ public class EsGoodsIndex implements Serializable {
/**
* @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum
*/
@ApiModelProperty(value = "商品sku编号当前商品中第几个sku", required = true)
private Integer skuNo;
@ApiModelProperty(value = "商品sku基础分数", required = true)
private Integer skuSource;
/**
* 商品属性(参数和规格)

View File

@@ -139,10 +139,10 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
skuQueryWrapper.eq(GoodsSku::getMarketEnable, GoodsStatusEnum.UPPER.name());
List<GoodsSku> goodsSkuList = goodsSkuService.list(skuQueryWrapper);
int skuNo = 100;
int skuSource = 100;
for (GoodsSku goodsSku : goodsSkuList) {
EsGoodsIndex esGoodsIndex = wrapperEsGoodsIndex(goodsSku, goods);
esGoodsIndex.setSkuNo(skuNo--);
esGoodsIndex.setSkuSource(skuSource--);
esGoodsIndices.add(esGoodsIndex);
//库存锁是在redis做的所以生成索引同时更新一下redis中的库存数量
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());