18 Dec, 2025

1 commit

  • 新增: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