feat: upgrade search to live dropdown with paper-level results + debounce

This commit is contained in:
2026-06-09 15:52:47 +00:00
parent 3d869fd1fd
commit 7bbc0f912f
3 changed files with 115 additions and 9 deletions

View File

@@ -148,8 +148,8 @@
### 4. 翻译覆盖率
翻译 PDF 存储在容器内 `/app/papers/translated/`,通过 volume 挂载持久化。翻译 API (`POST /api/translate/{paper_id}`) 会检查是否已翻译,避免重复。
### 5. 搜索是简单子串匹配
`GET /api/papers?q=...` 用 Python `in` 操作符在 title + authors 中做子串匹配。不支持模糊搜索、中文分词或 relevance ranking。对于 189 篇论文规模够用,但超过 500 篇可能需要改进
### 5. 搜索实现2026-06-09 已修复)
搜索已在 2026-06-09 升级为**实时下拉结果面板**。输入 ≥2 字符后200ms debounce 后调用 `/api/papers?q=`,在下拉面板中显示匹配论文(标题高亮、模块/领域、年份、标签)。卡片同步绿框高亮。点击结果项跳转到对应模块弹窗。点外部或 Escape 关闭
### 6. 数据一致性
`papers.json` 是唯一数据源。新增论文通过 API 写操作 → 自动更新 JSON → 前端下次请求时自动获取最新数据。**不要手动编辑 production 上的 papers.json 绕过 API**,可能导致并发写入问题。