feat: 新增首页全局搜索功能,支持跨模块多词搜索

This commit is contained in:
DXC
2026-04-27 15:57:26 +08:00
parent ec71cb24f4
commit d6ae9499db
5 changed files with 205 additions and 2 deletions

View File

@ -200,6 +200,19 @@ def create_app():
except ImportError as e:
print(f"❌ 错误: Warehouse 模块导入失败: {e}")
# -----------------------------------------------------
# 2.12 注册通用聚合搜索模块 (Common - Global Search)
# -----------------------------------------------------
try:
from app.api.v1.common import common_bp
# 标准: /api/v1/common/global-search
app.register_blueprint(common_bp, url_prefix='/api/v1/common')
# 兼容: /api/common/global-search
app.register_blueprint(common_bp, url_prefix='/api/common', name='common_legacy')
print("✅ Common 模块注册成功")
except ImportError as e:
print(f"❌ 错误: Common 模块导入失败: {e}")
# =========================================================
# 3. 预加载数据模型
# =========================================================
@ -227,4 +240,4 @@ def create_app():
except Exception as e:
print(f"⚠️ 模型预加载发生未知错误: {e}")
return app
return app