12 Mar, 2026

1 commit


05 Feb, 2026

1 commit

  • - API:新增请求参数 ai_search,开启时在窗口内走重排流程
    - 配置:RerankConfig 移除 enabled/expression/description,仅保留 rerank_window 及
      service_url/timeout_sec/weight_es/weight_ai;默认超时 15s
    - 重排流程:ai_search 且 from+size<=rerank_window 时,ES 取前 rerank_window 条,
      调用外部 /rerank 服务,融合 ES 与重排分数后按 from/size 分页;否则不重排
    - search/rerank_client:新增模块,封装 build_docs、call_rerank_service、
      fuse_scores_and_resort、run_rerank;超时单独捕获并简短日志
    - search/searcher:移除 RerankEngine,enable_rerank=ai_search,使用 config.rerank 参数
    - 删除 search/rerank_engine.py(本地表达式重排),统一为外部服务一种实现
    - 文档:搜索 API 对接指南补充 ai_search 与 relevance_score 说明
    - 测试:conftest 中 rerank 配置改为新结构
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    tangwang
     

06 Jan, 2026

1 commit

  • mappings/search_products.json:把原来的 title_zh/title_en/brief_zh/... 改成 按语言 key 的对象结构( /products/_doc/1 { "title": {"en":...} } )
    同时在这些字段下 预置了全部 analyzer 语言:
    arabic, armenian, basque, brazilian, bulgarian, catalan, chinese, cjk, czech, danish, dutch, english, finnish, french, galician, german, greek, hindi, hungarian, indonesian, italian, norwegian, persian, portuguese, romanian, russian, spanish, swedish, turkish, thai
    
    实现为 type: object + properties,同时满足“按语言灌入”和“按语言 analyzer”。
    索引灌入(全量/增量/transformer)已同步改完
    indexer/document_transformer.py:输出从 title_zh/title_en/... 改为:
    title: {<primary_lang>: 原文, en?: 翻译, zh?: 翻译}
    brief/description/vendor 同理
    category_path/category_name_text 也改为语言对象(避免查询侧继续依赖旧字段)
    indexer/incremental_service.py:embedding 取值从 title_en/title_zh 改为从 title 对象里优先取 en,否则取 zh,否则取任一可用语言。
    查询侧与配置、API/文档已同步
    search/es_query_builder.py:查询字段统一改成点路径:title.zh / title.en / vendor.zh / vendor.zh.keyword / category_name_text.zh 等。
    config/config.yaml:field boosts / indexes 里的字段名同步为新点路径。
    API & formatter:
    api/result_formatter.py 已支持新结构(并保留对旧 *_zh/_en 的兼容兜底)。
    api/models.py、相关 docs/examples 里的 vendor_zh.keyword 等已更新为 vendor.zh.keyword。
    文档/脚本:docs/、README.md、scripts/ 里所有旧字段名引用已批量替换为新结构。
    tangwang
     

18 Dec, 2025

1 commit

  • config/config_loader.py: 从 QueryConfig 类中删除 enable_translation 字段
    config/config.yaml: 删除 enable_translation: true 配置项
    config/config_loader.py: 从 to_dict() 方法中删除相关输出
    2. 索引阶段(离线)- 使用租户配置
    indexer/indexing_utils.py:
    根据 tenant_config.translate_to_en 和 translate_to_zh 决定是否初始化 translator
    只有任一方向开启时才创建 translator
    indexer/document_transformer.py:
    _fill_text_fields 从 tenant_config 读取 translate_to_en 和 translate_to_zh
    调用 translate_for_indexing 时传递这两个参数
    更新了文档注释
    3. 查询阶段(在线)- 使用租户配置
    query/query_parser.py:
    parse() 方法新增 tenant_id 参数
    根据租户配置决定翻译目标语言(translate_to_zh / translate_to_en)
    如果两个都是 false,跳过翻译阶段
    translator 属性不再依赖 enable_translation,总是可以初始化
    search/searcher.py:
    search() 方法中根据租户配置计算 enable_translation(用于日志和 metadata)
    调用 query_parser.parse() 时传递 tenant_id
    4. 翻译器方法更新
    query/translator.py:
    translate_for_indexing() 新增 translate_to_en 和 translate_to_zh 参数(默认 True 保持向后兼容)
    根据这两个参数决定翻译目标
    更新了文档注释
    tangwang
     

02 Dec, 2025

2 commits

  • 1. 加了一个配置searchable_option_dimensions,功能是配置子sku的option1_value option2_value option3_value 哪些参与检索(进索引、以及在线搜索的时候将对应字段纳入搜索field)。格式为list,选择三者中的一个或多个。
    
    2. 索引 @mappings/search_products.json 要加3个字段 option1_values option2_values option3_values,各自的 数据灌入(mysql->ES)的模块也要修改,这个字段是对子sku的option1_value option2_value option3_value分别提取去抽后得到的list。
    searchable_option_dimensions 中配置的,才进索引,比如 searchable_option_dimensions = ['option1'] 则 只对option1提取属性值去重组织list进入索引,其余两个字段为空
    
    3. 在线 对应的将 searchable_option_dimensions 中 对应的索引字段纳入 multi_match 的 fields,权重设为0.5 (各个字段的权重配置放到一起集中管理)
    
    1. 配置文件改动 (config/config.yaml)
    ✅ 在 spu_config 中添加了 searchable_option_dimensions 配置项,默认值为 ['option1', 'option2', 'option3']
    ✅ 添加了3个新字段定义:option1_values, option2_values, option3_values,类型为 KEYWORD,权重为 0.5
    ✅ 在 default 索引域的 fields 列表中添加了这3个字段,使其参与搜索
    2. ES索引Mapping改动 (mappings/search_products.json)
    ✅ 添加了3个新字段:option1_values, option2_values, option3_values,类型为 keyword
    3. 配置加载器改动 (config/config_loader.py)
    ✅ 在 SPUConfig 类中添加了 searchable_option_dimensions 字段
    ✅ 更新了配置解析逻辑,支持读取 searchable_option_dimensions
    ✅ 更新了配置转换为字典的逻辑
    4. 数据灌入改动 (indexer/spu_transformer.py)
    ✅ 在初始化时加载配置,获取 searchable_option_dimensions
    ✅ 在 _transform_spu_to_doc 方法中添加逻辑:
    从所有子SKU中提取 option1, option2, option3 值
    去重后存入 option1_values, option2_values, option3_values
    根据配置决定哪些字段实际写入数据(未配置的字段写空数组)
    
    =
    tangwang
     
  • query config/ranking config优化
    tangwang
     

13 Nov, 2025

2 commits


11 Nov, 2025

1 commit

  • ## 🎯 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>
    tangwang