Task ID: eb06a191-3527-485f-a36b-76a204a1f616
Ensure the /search page works end-to-end: fast API responses, all content types return results, FTS indexes are healthy.
/api/search endpoint was taking ~10 seconds to respond despite all individual DB queries completing in <25ms. Root cause: the search logging INSERT INTO search_queries at the end of the endpoint used get_db() which creates a connection with timeout=10. Under heavy write contention from other agents, this INSERT would wait up to 10 seconds for a write lock, blocking the entire API response.Fix: Use a separate SQLite connection with timeout=0.5 for the logging INSERT, and close the read connection first. If the DB is locked, the log entry is silently skipped (best-effort logging).
analyses_fts and wiki_pages_fts had stale content ("missing row N from content table" errors), causing FTS queries to fail and fall back to slower LIKE queries.Fix: Rebuilt both FTS indexes via INSERT INTO table(table) VALUES('rebuild'). Added rebuild_fts.py utility script for future maintenance.