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
     

25 Nov, 2025

1 commit

  • 主要是对 分类 属性 子sku 等重要字段的处理。
    参考文档《 @docs/索引字段说明v2-mapping结构.md 》《 @docs/索引字段说明v2.md 》
    
    feat:
    1. 更新 field_types.py
    添加 hanlp_index/hanlp_standard 分析器映射(映射到 CHINESE_ECOMMERCE/CHINESE_ECOMMERCE_QUERY)
    支持 keyword_normalizer 配置(用于 vendor.keyword 的 lowercase normalizer)
    更新 get_default_analyzers() 添加 hanlp 分析器和 lowercase normalizer
    修复 image_embedding 的 url 字段类型为 text
    
    2. 更新 config.yaml(32-207行)
    移除无用字段:handle, seo_title, seo_description, seo_keywords, shoplazza_created_at, shoplazza_updated_at
    添加中英文字段:title_zh, title_en, brief_zh, brief_en, description_zh, description_en, vendor_zh, vendor_en
    添加 category 多层级字段:category_path_zh, category_path_en, category_name_zh, category_name_en, category_id, category_name, category_level, category1_name, category2_name, category3_name
    添加 specifications 嵌套字段
    添加 option 名称字段:option1_name, option2_name, option3_name
    添加 SKU 扁平化字段:sku_prices, sku_weights, sku_weight_units, total_inventory
    更新 skus 嵌套结构以匹配目标 mapping
    添加 image_embedding 嵌套字段
    更新 indexes 配置以使用新字段名
    
    3. 更新 config_loader.py
    添加 keyword_normalizer 字段支持
    
    4. 重构 spu_transformer.py
    添加 load_option_data() 方法从 option 表加载数据
    更新 transform_batch() 加载 option 数据
    重构 _transform_spu_to_doc():
    实现中英文字段映射(暂时只填充中文)
    实现 category 多层级字段映射和 category_path 解析
    实现 specifications 构建(从 option 表获取 name,从 SKU 获取 value)
    实现 option 名称字段映射
    实现 SKU 扁平化字段计算
    更新 skus 嵌套结构
    重构 _transform_sku_row() 以匹配新的 SKU 结构
    移除 SEO 和 handle 字段的处理
    tangwang