23 Mar, 2026

2 commits


22 Mar, 2026

2 commits


20 Mar, 2026

3 commits

  • tangwang
     
  • ResultFormatter.format_search_results() runs.
    
    What changed:
    
    For each final paginated SPU hit, the searcher now scans
    skus[].option1_value against the query text set built from the original
    query, normalized query, rewritten query, and translations.
    If no option1_value matches textually, it falls back to embedding
    similarity and picks the SKU with the highest inner product against the
    query embedding.
    The matched SKU is promoted to the front of the SPU’s skus list.
    The SPU-level image_url is replaced with that matched SKU’s image_src.
    I left api/result_formatter.py unchanged because it already preserves
    the SKU order and reads image_url from _source; updating the page hits
    in searcher makes the formatter return the desired result automatically.
    
    Verification:
    
    ReadLints on the edited files: no errors
    Passed targeted tests:
    pytest tests/test_search_rerank_window.py -k "translated_query or
    no_direct_option_match"
    tangwang
     
  • tangwang
     

18 Mar, 2026

3 commits


13 Mar, 2026

3 commits


12 Mar, 2026

4 commits


11 Mar, 2026

2 commits


10 Mar, 2026

4 commits

  • tangwang
     
  • - 配置改为“字段基名 + 动态语言后缀”方案,已不再依赖旧 `indexes`。
    [config.yaml](/data/saas-search/config/config.yaml#L17)
    - `search_fields` / `text_query_strategy` 已进入强校验与解析流程。
    [config_loader.py](/data/saas-search/config/config_loader.py#L254)
    
    2. 查询语言计划与翻译等待策略
    - `QueryParser` 现在产出
      `query_text_by_lang`、`search_langs`、`source_in_index_languages`。
    [query_parser.py](/data/saas-search/query/query_parser.py#L41)
    - 你要求的两种翻译路径都在:
      - 源语言不在店铺 `index_languages`:`translate_multi_async` + 等待
        future
      - 源语言在 `index_languages`:`translate_multi(...,
        async_mode=True)`,尽量走缓存
    [query_parser.py](/data/saas-search/query/query_parser.py#L284)
    
    3. ES 查询统一文本策略(无 AST 分支)
    - 主召回按 `search_langs` 动态拼 `field.{lang}`,翻译语种做次权重
      `should`。
    [es_query_builder.py](/data/saas-search/search/es_query_builder.py#L454)
    - 布尔 AST 路径已删除,仅保留统一文本策略。
    [es_query_builder.py](/data/saas-search/search/es_query_builder.py#L185)
    
    4. LanguageDetector 优化
    - 从“拉丁字母默认英文”升级为:脚本优先 +
      拉丁语系打分(词典/变音/后缀)。
    [language_detector.py](/data/saas-search/query/language_detector.py#L68)
    
    5. 布尔能力清理(补充)
    - 已删除废弃模块:
    [boolean_parser.py](/data/saas-search/search/boolean_parser.py)
    - `search/__init__` 已无相关导出。
    [search/__init__.py](/data/saas-search/search/__init__.py)
    
    6. `indexes` 过时收口(补充)
    - 兼容函数改为基于动态字段生成,不再依赖 `config.indexes`。
    [utils.py](/data/saas-search/config/utils.py#L24)
    - Admin 配置接口改为返回动态字段配置,不再暴露 `num_indexes`。
    [admin.py](/data/saas-search/api/routes/admin.py#L52)
    
    7. suggest
    tangwang
     
  • tangwang
     
  • tangwang
     

09 Mar, 2026

2 commits


07 Mar, 2026

2 commits


05 Feb, 2026

2 commits

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

27 Jan, 2026

2 commits


06 Jan, 2026

1 commit


31 Dec, 2025

1 commit


27 Dec, 2025

1 commit


20 Dec, 2025

1 commit


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
     

08 Dec, 2025

1 commit


05 Dec, 2025

1 commit

  • 将 must 子句改为 should 子句的多查询策略
    实现以下查询类型:
    base_query:主查询,使用 AND 操作符和 75% minimum_should_match
    翻译查询:跨语言查询,boost=0.4
    短语查询:短查询的精确短语匹配
    关键词查询:基于提取名词的查询,boost=0.1
    添加 _get_match_fields() 方法,支持中英文字段动态映射
    4. 关键改进点
    minimum_should_match 从 67% 提升到 75%
    添加 operator: "AND" 确保所有词都匹配
    使用 should 子句实现多策略融合
    支持短语查询和关键词查询的智能触发
    tangwang
     

04 Dec, 2025

1 commit

  • 核心功能:
    - 添加 multi_select 字段到 FacetConfig(默认为 true)
    - 实现 post_filter 支持 disjunctive faceting
    - 后端自动标记 facet 值的 selected 状态
    - 支持 specifications 和普通字段的 multi-select
    
    技术改进:
    - ESQueryBuilder: 分离 conjunctive/disjunctive filters
    - ResultFormatter: 根据 current_filters 标记 selected
    - Searcher: 传递 facet_configs 给 query builder
    
    文档更新:
    - 添加 multi_select_faceting.md 详细文档
    - 更新 API 对接指南,说明新功能
    - 添加测试脚本 test_multi_select_facet.py
    
    业界标准:
    - 遵循 Elasticsearch/Algolia/Amazon 的最佳实践
    - 提供探索式搜索体验
    - 前后端职责清晰分离
    tangwang
     

03 Dec, 2025

1 commit

  • {
      "facets": [
        {
          "field": "category1_name",
          "size": 15,
          "type": "terms"
        },
        "specifications.color",
        "specifications.size"
      ]
    }
    
    {
      "facets": [
        {"field": "category1_name", "size": 15, "type": "terms"},
        {"field": "specifications.color", "size": 10, "type": "terms"},
        {"field": "specifications.size", "size": 10, "type": "terms"}
      ]
    }
    
    之前是上面的接口形式,主要是考虑 属性的分面, 因为 款式都是有限的 不需要设定 "size": 10, "type": "terms" 这些参数。
    
    但是从接口设计层面,最好按下面这样,这样的话 specifications.color 和 category1_name 的组装格式 完全一样。前端不需要感知 属性分面 和 类别等其他字段分面的差异。
    tangwang