Skip to content

Commit c1f7ee7

Browse files
kennethreitzclaude
andcommitted
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>
1 parent 2ab3dfa commit c1f7ee7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kjvstudy_org/routes/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ async def search_page(request: Request, q: str = Query(None, description="Search
128128
is_direct_verse = False
129129

130130
if q and len(q.strip()) >= 2:
131-
# Search Bible verses
132-
search_results = perform_full_text_search(q.strip())
131+
# Search Bible verses (cap at 50 to keep template rendering fast)
132+
search_results = perform_full_text_search(q.strip(), limit=50)
133133
# Check if this was a direct verse reference match
134134
if search_results and len(search_results) == 1 and search_results[0].get("score") == 100.0:
135135
is_direct_verse = True

0 commit comments

Comments
 (0)