08 Mar, 2026

1 commit


07 Mar, 2026

1 commit


06 Mar, 2026

2 commits


05 Mar, 2026

1 commit


02 Mar, 2026

1 commit


05 Feb, 2026

1 commit


26 Jan, 2026

2 commits


06 Jan, 2026

2 commits

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

31 Dec, 2025

2 commits


29 Dec, 2025

2 commits


25 Dec, 2025

1 commit


22 Dec, 2025

1 commit


19 Dec, 2025

1 commit


18 Dec, 2025

3 commits

  • 新增:scripts/recreate_index.py
    功能:初始化 indexer 的 ES/DB 服务,然后调用 BulkIndexingService.bulk_index(…, recreate_index=True) 为指定 tenant_id 做「删除并重建索引 + 全量导入」。
    用法示例:
    cd /home/tw/SearchEngine# 使用默认 batch_size=500python scripts/recreate_index.py 162# 指定 batch_sizepython scripts/recreate_index.py 162 --batch-size 1000
    脚本依赖和 Indexer API 一样的环境变量:DB_HOST/DB_PORT/DB_DATABASE/DB_USERNAME/DB_PASSWORD、ES_HOST/ES_USERNAME/ES_PASSWORD。
    2. 清理与引用更新
    原来的 scripts/recreate_index.sh 已经删除。
    api/routes/indexer.py 里的说明改成引用 scripts/recreate_index.py。
    docs/搜索API对接指南.md 中的提示也从 .sh 改为:
    > python scripts/recreate_index.py <tenant_id> [--batch-size 500]
    tangwang
     
  • 新增 api/indexer_app.py,在独立进程(默认 6004)中初始化 ES + DB + 索引服务,并复用 api/routes/indexer.py 一套路由
    新增 api/service_registry.py,通过注册表向索引路由注入 ES 客户端和索引服务,消除重复代码与循环依赖
    main.py 增加 serve-indexer 子命令;scripts/start.sh / stop.sh / start_backend.sh / start_indexer.sh 支持独立管理索引进程
    文档中所有索引相关示例由 6002/indexer/* 统一调整为 6004/indexer/*
    tangwang
     
  • 1. 添加了两个开关参数
    --keep-spu-if-parent-missing:保留父ASIN不在变体列表中的SPU(默认:丢弃整个SPU)
    --fix-sku-if-title-mismatch:修正标题不一致的SKU而不是丢弃(默认:丢弃标题不一致的SKU)
    2. 实现了相关逻辑
    父ASIN缺失处理:
    默认:当父ASIN不在变体列表中时,打印警告并丢弃整个SPU
    使用 --keep-spu-if-parent-missing:保留SPU,使用第一个变体作为主商品
    标题不一致处理:
    默认:当变体标题与主商品不一致时,打印日志并丢弃该SKU
    使用 --fix-sku-if-title-mismatch:修正变体标题为主商品标题
    tangwang
     

17 Dec, 2025

7 commits


05 Dec, 2025

1 commit


29 Nov, 2025

1 commit


28 Nov, 2025

1 commit

  • 脚本:scripts/csv_to_excel_multi_variant.py
    
    主要功能:
    单一款式商品(S 类型)- 30%
    商品属性为 S
    不填写 option1/option2/option3
    包含所有商品信息(标题、描述、价格、库存等)
    多款式商品(M+P 类型)- 70%
    M 行(商品主体):
    商品属性为 M
    填写商品主体信息(标题、描述、SEO、分类等)
    option1="color", option2="size", option3="material"
    不填写价格、库存、SKU 等子款式信息
    P 行(子款式):
    商品属性为 P
    商品标题与 M 行一致
    option1/2/3 填写具体值(color、size、material 的笛卡尔积)
    每个 SKU 有独立的价格、库存、SKU 编码等
    多款式商品生成规则:
    Color(颜色):从 color1 到 color30 中随机选择 2-10 个
    Size(尺寸):从 1-30 中随机选择 4-8 个
    Material(材质):从商品标题按空格分割后的最后一个字符串提取(去掉特殊字符)
    笛卡尔积:生成所有组合的 P 行(例如:3 个颜色 × 5 个尺寸 × 1 个材质 = 15 个 SKU)
    tangwang
     

26 Nov, 2025

1 commit


25 Nov, 2025

1 commit

  • mappings/search_products.json - 完整的ES索引配置(settings + mappings)
    基于 docs/索引字段说明v2-mapping结构.md
    简化 mapping_generator.py
    移除所有config依赖
    直接使用 load_mapping() 从JSON文件加载
    保留工具函数:create_index_if_not_exists, delete_index_if_exists, update_mapping
    更新数据导入脚本
    scripts/ingest_shoplazza.py - 移除ConfigLoader依赖
    直接使用 load_mapping() 和 DEFAULT_INDEX_NAME
    更新indexer模块
    indexer/__init__.py - 更新导出
    indexer/bulk_indexer.py - 简化IndexingPipeline,移除config依赖
    创建查询配置常量
    search/query_config.py - 硬编码字段列表和配置项
    
    使用方式
    创建索引:
    from indexer.mapping_generator import load_mapping, create_index_if_not_existsfrom utils.es_client import ESClientes_client = ESClient(hosts=["http://localhost:9200"])mapping = load_mapping()create_index_if_not_exists(es_client, "search_products", mapping)
    数据导入:
    python scripts/ingest_shoplazza.py \    --db-host localhost \    --db-database saas \    --db-username root \    --db-password password \    --tenant-id "1" \    --es-host http://localhost:9200 \    --recreate
    
    注意事项
    修改mapping:直接编辑 mappings/search_products.json
    字段映射:spu_transformer.py 中硬编码,与mapping保持一致
    config目录:保留但不再使用,可后续清理
    search模块:仍依赖config
    tangwang
     

18 Nov, 2025

1 commit


14 Nov, 2025

6 commits