namespace OASystem.API.OAMethodLib.GenericSearch { /// /// 动态搜索请求 /// public class DynamicSearchRequest { /// /// 搜索关键词 /// public string Keyword { get; set; } /// /// 字段权重配置(字段名:权重值) /// public Dictionary FieldWeights { get; set; } = new Dictionary(); /// /// 返回字段列表(为空则返回所有字段) /// public List ReturnFields { get; set; } = new List(); /// /// 过滤条件 /// public List Filters { get; set; } = new List(); /// /// 排序字段 /// public string OrderBy { get; set; } /// /// 是否降序排序 /// public bool IsDescending { get; set; } = true; /// /// 页码(从1开始) /// public int PageIndex { get; set; } = 1; /// /// 页大小 /// public int PageSize { get; set; } = 20; } /// /// 搜索过滤器 /// public class SearchFilter { /// /// 字段名 /// public string Field { get; set; } /// /// 操作符(eq, neq, contains, startswith, endswith, gt, gte, lt, lte, in) /// public string Operator { get; set; } /// /// 字段值 /// public object Value { get; set; } /// /// 字段值列表(用于IN操作) /// public List Values { get; set; } } /// /// 匹配字段信息 /// public class MatchFieldInfo { /// /// 字段名 /// public string FieldName { get; set; } /// /// 字段值 /// public string FieldValue { get; set; } /// /// 匹配分数 /// public int Score { get; set; } /// /// 匹配原因 /// public string MatchReason { get; set; } } /// /// 搜索结果项(包含匹配度分数) /// /// 实体类型 public class SearchResultItem { /// /// 实体数据 /// public T Data { get; set; } /// /// 匹配度分数 /// public int MatchScore { get; set; } /// /// 匹配字段信息 /// public List MatchFields { get; set; } = new List(); } /// /// 搜索结果(应用层统计匹配度) /// /// 实体类型 public class SearchResult { /// /// 是否成功 /// public bool Success { get; set; } = true; /// /// 消息 /// public string Message { get; set; } = "搜索成功"; /// /// 数据列表(包含匹配度信息) /// public List> Items { get; set; } = new List>(); /// /// 总记录数 /// public int TotalCount { get; set; } /// /// 搜索关键词 /// public string Keyword { get; set; } /// /// 使用的字段权重配置 /// public Dictionary FieldWeights { get; set; } /// /// 返回的字段列表 /// public List ReturnFields { get; set; } /// /// 页码 /// public int PageIndex { get; set; } /// /// 页大小 /// public int PageSize { get; set; } /// /// 响应时间(毫秒) /// public long ResponseTime { get; set; } /// /// 搜索ID(用于追踪) /// public string SearchId { get; set; } } /// /// 字段信息 /// public class FieldInfo { /// /// 字段名 /// public string FieldName { get; set; } /// /// 显示名称 /// public string DisplayName { get; set; } /// /// 数据类型 /// public string DataType { get; set; } /// /// 是否可搜索 /// public bool IsSearchable { get; set; } /// /// 默认权重 /// public int DefaultWeight { get; set; } /// /// 字段描述 /// public string Description { get; set; } /// /// 是否可过滤 /// public bool CanFilter { get; set; } = true; /// /// 是否可排序 /// public bool CanSort { get; set; } = true; } /// /// 搜索分析结果 /// public class SearchAnalysis { /// /// 原始关键词 /// public string OriginalKeyword { get; set; } /// /// 是否有特殊符号 /// public bool HasSpecialSymbols { get; set; } /// /// 符号分割的段 /// public List SymbolSegments { get; set; } = new List(); /// /// 是否是单字 /// public bool IsSingleChar { get; set; } /// /// 单字列表 /// public List SingleChars { get; set; } = new List(); /// /// 是否有搜索内容 /// public bool HasSearchContent => HasSpecialSymbols || IsSingleChar; } }