using OpenSearch.Client; namespace Store.Modules.CloudProduct.Dtos { /// /// 商品搜索文档:OpenSearch 索引中的商品模型,Id 为主键,Title 用于分词搜索 /// 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; /// 一级类目ID [Number(NumberType.Integer, Name = "cat_id_1")] public int? CatId1 { get; set; } /// 二级类目ID [Number(NumberType.Integer, Name = "cat_id_2")] public int? CatId2 { get; set; } /// 三级类目ID [Number(NumberType.Integer, Name = "cat_id_3")] public int? CatId3 { get; set; } /// 四级类目ID [Number(NumberType.Integer, Name = "cat_id_4")] public int? CatId4 { get; set; } /// 最低价快照,用于价格区间过滤和按价格排序 [Number(NumberType.Long, Name = "min_price")] public long? MinPrice { get; set; } /// 销量,用于按销量排序 [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}"; } }