Files
backend/backend/app
34047007@qq.com a4d27da8ea
CI / backend (push) Waiting to run
CI / frontend (push) Waiting to run
fix: 生产高级搜索 500 — 预算超时降级 + pub_date 排序索引 + affiliations_text trgm 反范式列
- count/主查询独立短预算,超时降级不再 500:count 超时返回 _COUNT_CAP(10 万+)
  而非 0(修复"找到 0 条结果"、分页被隐藏),主查询超时降级空结果
- 年份筛选改用 pub_date 范围,主查询 ORDER BY pub_date DESC NULLS LAST, id DESC
  走新索引 ix_gl_pub_date_sort(Index Scan,替代 Parallel Seq Scan + Sort,89.5 万行 40s→<0.2s)
- affiliations_text 反规范化列 + gin_trgm 索引 + 触发器维护,替换 7 处 jsonb lateral
  EXISTS(病理查询慢 ~40x);存量由 scripts/backfill_affiliations.py 分批后台回填
- ATM 门控 _has_structured_terms:结构化查询(含字段标签)的 plain 词不做 MeSH 展开,
  修复 "lung neoplasms[MAJR]+年份" count 5s + main 6s 双超时(11.72s→2.02s)
- query_expansion/mesh IN(subquery) 去显式 DISTINCT(百万级 id 集合物化排序)
- alembic env 改 connect()(transaction_per_migration 每迁移独立事务,支持迁移内分批提交)
2026-08-10 21:48:42 +08:00
..