mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user