Limit search results to 50 to fix slow page rendering

Search for common terms like "love" returned 363+ results, causing
the Jinja2 template to render 222KB of HTML (~8s on shared CPU).
Capping at 50 results drops render time to ~0.4s locally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 22:02:34 -05:00
parent 2ab3dfa142
commit c1f7ee766b
+2 -2
View File
@@ -128,8 +128,8 @@ async def search_page(request: Request, q: str = Query(None, description="Search
is_direct_verse = False
if q and len(q.strip()) >= 2:
# Search Bible verses
search_results = perform_full_text_search(q.strip())
# Search Bible verses (cap at 50 to keep template rendering fast)
search_results = perform_full_text_search(q.strip(), limit=50)
# Check if this was a direct verse reference match
if search_results and len(search_results) == 1 and search_results[0].get("score") == 100.0:
is_direct_verse = True