49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using OpenSearch.Client;
|
|
|
|
namespace Store.Modules.CloudProduct.Dtos
|
|
{
|
|
/// <summary>
|
|
/// 商品搜索文档:OpenSearch 索引中的商品模型,Id 为主键,Title 用于分词搜索
|
|
/// </summary>
|
|
public class GoodsSearchDocument
|
|
{
|
|
[Number(NumberType.Byte, Name = "platform")]
|
|
public byte Platform { get; set; }
|
|
|
|
[Number(NumberType.Long, Name = "id")]
|
|
public long Id { get; set; }
|
|
|
|
[Text(Name = "title", Analyzer = "ik_max_word", SearchAnalyzer = "ik_smart")]
|
|
public string Title { get; set; } = string.Empty;
|
|
|
|
[Text(Name = "thumbUrl")]
|
|
public string? ThumbUrl { get; set; } = string.Empty;
|
|
|
|
/// <summary>一级类目ID</summary>
|
|
[Number(NumberType.Integer, Name = "cat_id_1")]
|
|
public int? CatId1 { get; set; }
|
|
|
|
/// <summary>二级类目ID</summary>
|
|
[Number(NumberType.Integer, Name = "cat_id_2")]
|
|
public int? CatId2 { get; set; }
|
|
|
|
/// <summary>三级类目ID</summary>
|
|
[Number(NumberType.Integer, Name = "cat_id_3")]
|
|
public int? CatId3 { get; set; }
|
|
|
|
/// <summary>四级类目ID</summary>
|
|
[Number(NumberType.Integer, Name = "cat_id_4")]
|
|
public int? CatId4 { get; set; }
|
|
|
|
/// <summary>最低价快照,用于价格区间过滤和按价格排序</summary>
|
|
[Number(NumberType.Long, Name = "min_price")]
|
|
public long? MinPrice { get; set; }
|
|
|
|
/// <summary>销量,用于按销量排序</summary>
|
|
[Number(NumberType.Integer, Name = "sold_quantity")]
|
|
public int SoldQuantity { get; set; }
|
|
|
|
public override string ToString() => $"[Id={Id}] Title={Title} Cat=({CatId1},{CatId2},{CatId3},{CatId4}) Price={MinPrice} Sold={SoldQuantity}";
|
|
}
|
|
}
|