Projects BibleWeb Search Full-text search (EN + NL)
Done

Full-text search (EN + NL)

Area: Search Milestone: v1

Context

Problem: Users need to find specific words, phrases, or concepts across the entire Bible. Manual searching through 31,000+ verses is impractical.

Solution: FTS5-powered full-text search across both English (BSB) and Dutch (Statenvertaling) translations, with instant results ranked by relevance.

Not included: Semantic/meaning-based search or AI-powered search. This is keyword matching with stemming.

Functional

Users type a search query and get instant results from across the Bible, with the option to search in English, Dutch, or Greek (Strong's concordance).

User flow:

  1. User navigates to /search
  2. Selects search mode: NL, EN, or Greek (tab buttons)
  3. Types a query (minimum 2 characters)
  4. Results appear after 300ms debounce, ranked by FTS5 relevance
  5. Each result shows: book name, chapter:verse, verse text with query terms highlighted
  6. Click a result → navigates to that chapter in the reader

Edge cases:

  • English queries: words are quoted and AND-joined for phrase/intersection matching
  • Dutch queries: expanded via expandDutchQuery() with morphological synonyms (see Dutch Synonym Expansion)
  • Jesus-words filter can be toggled to show only Jesus' direct speech results
  • Rate limited: 60 req/min per IP

UX & Design

Search input: Large search box with magnifying glass icon, "Type at least 2 characters" placeholder.

Mode tabs: NL | EN | Greek — switches between translation-specific and concordance search.

Results: Verse cards with book/chapter/verse reference + full verse text. Jesus-speech results shown in gold.

Keyboard hints: Footer shows "Type to search | Up/Down history | Tab toggle Jesus-only | Enter jump | Esc back"

Technical

FTS5 index: verse_texts_fts virtual table with porter and unicode61 tokenizers — indexes text from verse_texts table.

API: GET /api/search?q=...&translation=...&lang=...&jesusOnly=...&page=...&limit=50

Query building (search.ts):

  • English: each word quoted "word" and space-joined
  • Dutch: expandDutchQuery() maps 14 known Bible terms to morphological OR groups, unknown words get word* prefix matching
  • Jesus-only: adds JOIN jesus_speech js ON js.verse_id = v.id
  • Results ordered by FTS5 rank

Tables: verse_texts_fts, verse_texts, verses, books, bible_translations, jesus_speech

Files:

  • apps/web/src/routes/api/search/+server.ts — API endpoint
  • apps/web/src/lib/server/queries/search.tssearchVerses(), query building
  • apps/web/src/lib/server/queries/dutch-synonyms.tsexpandDutchQuery()
  • apps/web/src/routes/(app)/search/+page.svelte — search UI

Status

Current: DONE Milestone: v1 Priority: Core — essential Bible study tool

History:

  • BibleGame had basic search — web version significantly improved with FTS5
  • Dutch synonym expansion added later to improve Dutch search quality

Dependencies:

  • Requires: verse_texts_fts index (DONE), translations (DONE)
  • Used by: Jesus-words filter (DONE), pagination (DONE), search history (DONE)