02 Dec, 2025
1 commit
-
query config/ranking config优化
01 Dec, 2025
1 commit
27 Nov, 2025
2 commits
-
1. 搜索API对接指南.md 在“精确匹配过滤器”部分添加了 specifications 嵌套过滤说明 支持单个规格过滤和多个规格过滤(OR 逻辑) 在“分面配置”部分完善了 specifications 分面说明 添加了两种分面模式:所有规格名称和指定规格名称 在“常见场景示例”部分添加了场景5-8,包含规格过滤和分面的完整示例 2. 搜索API速查表.md 在“精确匹配过滤”部分添加了 specifications 过滤的快速参考 在“分面搜索”部分添加了 specifications 分面的快速参考 更新了完整示例,包含 specifications 的使用 3. Search-API-Examples.md 在“过滤器使用”部分添加了示例4-6,展示 specifications 过滤 在“分面搜索”部分添加了示例2-3,展示 specifications 分面 更新了 Python 和 JavaScript 完整示例,包含 specifications 的使用 在“常见使用场景”部分添加了场景2.1,展示带规格过滤的搜索结果页 4. 索引字段说明v2.md 更新了 specifications 字段的查询示例,包含 API 格式和 ES 查询结构 添加了两种分面模式的说明和示例 更新了“分面字段”说明,明确支持指定规格名称的分面 5. 补充参数 参数说明:sku_filter_dimension 是可选参数,用于按指定维度过滤每个SPU下的SKU 支持的维度: 直接选项字段:option1、option2、option3 规格名称:通过 option1_name、option2_name、option3_name 匹配(如 color、size)
-
1. 前端传递的过滤条件永远是要起作用的 2. 然后召回模块包括文本相关性召回(中英文都是用)和向量召回,两者相互补充。 3. 套用function_score以支持两种打分融合和各种提权字段 4. 只需要build_query 这一层。 实际操作: 1. 架构简化 移除了 MultiLanguageQueryBuilder 层级 只保留单层的 ESQueryBuilder.build_query 方法 2. 查询结构重构 实现了 filters and (text_recall or embedding_recall) 结构: 前端过滤条件:永远起作用(放在 filter 中) 文本召回:同时搜索中英文字段(multi_match 覆盖 title_zh/en, brief_zh/en 等) 向量召回:KNN 查询(独立参数,ES 会自动合并) Function_score:包装召回部分,支持提权字段配置 3. 文本匹配字段更新 在 DEFAULT_MATCH_FIELDS 中添加了中英文字段: 中文:title_zh, brief_zh, description_zh, vendor_zh, category_path_zh, category_name_zh 英文:title_en, brief_en, description_en, vendor_en, category_path_en, category_name_en 语言无关:tags 4. Function_score 框架保留 保留了 function_score 配置框架(FUNCTION_SCORE_CONFIG) 支持 filter_weight、field_value_factor、decay 等提权函数 可以从配置中扩展提权字段 5. 测试验证 所有功能测试通过: 基本文本搜索 带过滤条件的搜索 范围过滤 分面搜索 英文查询
26 Nov, 2025
2 commits
14 Nov, 2025
3 commits
-
2. 向量服务不用本地预估,改用网络服务
13 Nov, 2025
2 commits
-
主要变更: 1. 去掉数据源应用结构配置化,我们只针对店匠的spu sku表设计索引,数据灌入流程是写死的(只是满足测试需求,后面外层应用负责数据全量+增量灌入)。搜索系统主要关注如何适配外部搜索需求 目前有两个数据灌入脚本,一种是之前的,一种是现在的从两个店匠的表sku表+spu表读取并且以spu为单位组织doc。 - 配置只关注ES搜索相关配置,提高可维护性 - 创建base配置(店匠通用配置) 2. 索引结构重构(SPU维度) - 所有客户共享search_products索引,通过tenant_id隔离 - 支持嵌套variants字段(SKU变体数组) - 创建SPUTransformer用于SPU数据转换 3. API响应格式优化 - 约定一套搜索结果的格式,而不是直接暴露ES doc的结构(_id _score _source内的字段) - 添加ProductResult和VariantResult模型 - 添加suggestions和related_searches字段 (预留接口,逻辑暂未实现) 4. 数据导入流程 - 创建店匠数据导入脚本(ingest_shoplazza.py) - Pipeline层决定数据源,配置不包含数据源信息 - 创建测试数据生成和导入脚本 5. 文档更新 - 更新设计文档,反映新架构 - 创建BASE_CONFIG_GUIDE.md使用指南
12 Nov, 2025
4 commits
-
核心改动: 1. 修复facets类型问题 - 统一使用Pydantic模型(FacetResult, FacetValue) - SearchResult.facets改为List[FacetResult] - _standardize_facets直接构建Pydantic对象 2. 修复RangeFilter支持日期时间 - RangeFilter字段改为Union[float, str] - 支持数值范围和ISO日期时间字符串 - 修复前端listing time筛选422错误 3. 重构ES查询结构(核心) - 使用function_score包裹整个查询 - 文本和KNN放入内层bool.should(minimum_should_match=1) - Filter在外层bool,同时作用于文本和KNN查询 - 添加时效性加权函数(days_since_last_update<=30 weight:1.1) 4. RankingEngine重构 - 重命名为RerankEngine(语义更准确) - 默认禁用(enabled=False) - 优先使用ES的function_score打分 5. 统一约定原则 - 移除所有字典兼容代码 - 全系统统一使用Pydantic模型 - build_facets只接受str或FacetConfig - _build_filters直接接受RangeFilter模型 修改文件: - search/multilang_query_builder.py: 重构查询构建逻辑 - search/es_query_builder.py: 统一Pydantic模型支持 - search/searcher.py: 使用RerankEngine,更新导入 - search/rerank_engine.py: 新建(从ranking_engine.py重命名) - search/ranking_engine.py: 删除 - search/__init__.py: 更新导出 - api/models.py: RangeFilter支持Union[float, str] 测试验证: ✓ Facets正常返回 ✓ Filter同时作用于文本和KNN ✓ 日期时间范围过滤正常 ✓ Function score时效性加权正常 ✓ 所有测试通过 架构原则:统一约定,不做兼容,保持简单
11 Nov, 2025
4 commits
-
## 🎯 Major Features - Request context management system for complete request visibility - Structured JSON logging with automatic daily rotation - Performance monitoring with detailed stage timing breakdowns - Query analysis result storage and intermediate result tracking - Error and warning collection with context correlation ## 🔧 Technical Improvements - **Context Management**: Request-level context with reqid/uid correlation - **Performance Monitoring**: Automatic timing for all search pipeline stages - **Structured Logging**: JSON format logs with request context injection - **Query Enhancement**: Complete query analysis tracking and storage - **Error Handling**: Enhanced error tracking with context information ## 🐛 Bug Fixes - Fixed DeepL API endpoint (paid vs free API confusion) - Fixed vector generation (GPU memory cleanup) - Fixed logger parameter passing format (reqid/uid handling) - Fixed translation and embedding functionality ## 🌟 API Improvements - Simplified API interface (8→5 parameters, 37.5% reduction) - Made internal functionality transparent to users - Added performance info to API responses - Enhanced request correlation and tracking ## 📁 New Infrastructure - Comprehensive test suite (unit, integration, API tests) - CI/CD pipeline with automated quality checks - Performance monitoring and testing tools - Documentation and example usage guides ## 🔒 Security & Reliability - Thread-safe context management for concurrent requests - Automatic log rotation and structured output - Error isolation with detailed context information - Complete request lifecycle tracking 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
10 Nov, 2025
1 commit
08 Nov, 2025
2 commits