Skip to content

Search & verification

Modes and tiers

4 min readUpdated Verified against 7a343c6 on 2026-09-25

Page actions

ChatGPT and Claude are third-party services. The link gives them this page's public address and a short instruction. This site records nothing.

The six search modes a caller can ask for and the twelve tiers auto mode runs through, each with its entry condition, the index it queries and the mode string it reports.

/api/search?q=&mode=&limit=&offset= takes a query of at most 300 characters and a mode. The response always has mode (which tier answered), results (verbatim lines with their Ang, the transliteration and the English layer attached) and related_themes; a theme answer adds concept. limit is clamped to 0–200 and offset to 0–1,000,000, so a client can never dump the corpus by accident.

The modes

modeWhat it doesFalls back to
auto (default)detects the script and runs the waterfallevery tier in order
gurmukhithe verbatim text column (FTS)the skeleton column with vowel signs stripped (gurmukhi-skeleton)
romanthe translit column (FTS)the phonetic fold over translit_norm (roman-spelling-tolerant)
firstfirst letters of each word, as a phrase: fl_g for Gurmukhi, fl_r for Roman—
themethe concept index: the concept’s lines, with its description and totalthe one concept whose name folds like the query (waheguru → vahiguru), then a LIKE over concept names and descriptions
englishthe English translation layer, fts_en—

The tiers of auto mode

On the rendered wiki this is the simulator: run a query and the tier that answered is named and lit on the waterfall poster. On GitHub, the table below lists the same tiers.

TierEntry conditionWhat it queriesmode
Mixed scriptGurmukhi and Latin in the querymixed_search — one AND expression: Gurmukhi tokens on text, Latin tokens through variants, the lexicon and the fold; up to 10 tokensmixed-script
Latin part alonemixed script found nothingthe Latin tokens re-run through the waterfallmixed-script (latin part: …)
Gurmukhi first lettersevery token is one letter, ≥ 2 tokensfl_g phrasefirst-letters
Gurmukhi textGurmukhi querytext (FTS, bm25)gurmukhi
Gurmukhi skeletontext found nothingvowel signs stripped, skeleton LIKEgurmukhi-skeleton
Concept namethe query is exactly a concept key (naam, haumai, …), except vahiguru, which goes on to the lexiconthe concept indextheme
Roman first letters≥ 2 tokens, all ≤ 3 lettersfl_r phrase, then translitfirst-letters, roman
TransliterationRoman querytranslit (FTS, bm25)roman
Seeker lexiconnothing yeta curated table: a word → a transliteration term or a themeseeker-lexicon (term)
Variant indexnothing yetper-token romanisation variants (≤ 3 by frequency × score), trailing-vowel retry, all-but-one ANDvariant-match
English layernothing yetfts_en — before the fold, so an English word reaches translations rather than colliding with a foldenglish-translation
Honorifics droppednothing yet; ji, jee, jeo, jio, sahib, maharaj, shri, sri, baba, guru, dev, waale present; ≥ 2 tokens remainthe shorter query, through the waterfall… (honorifics dropped)
Passagenothing yet, ≥ 3 tokensfolded tokens AND in fts_shabad; the composition’s lines returned in orderpassage-match (quote spans lines)
Phonetic foldnothing yetroman_norm(query) tokens of ≥ 2 characters against translit_norm; headings excludedroman-spelling-tolerant
Skeleton blobnothing yet, ≤ 14 tokens, blob ≥ 8 charactersthe query collapsed to one fold-skeleton blob; lines prefiltered by its head, fuzzy-rankedskeleton-blob
Single-token themenothing yet, one tokenthe concept indextheme
Top-upany tier, < 3 results, honorifics presentthe honorific-dropped results appended… + honorific-dropped

Ranking

Every FTS tier ranks with SQLite’s bm25 and column weights 10 · 5 · 4 · 3 · 3 · 1 for text, translit, translit_norm, fl_g, fl_r, skeleton: the verbatim text outranks a transliteration hit, which outranks the fold, which outranks first letters and the skeleton. The passage tier ranks by the tightest span of matched lines, then bm25; the blob tier by fuzzy ratio.

What a client should rely on

  • results[].gurmukhi is verbatim and results[].ang is its Ang: cite them as Sri Guru Granth Sahib Ji · Ang N. translit is a reading aid; en is a labelled translation.
  • mode is informational — it names the tier and may carry a suffix; do not parse it for logic.
  • The search route is no-store (each query is answered afresh); reader routes are cacheable. See Versioning and caching.
  • Search is a contract: contract/golden_search.ndjson records real queries and their results, replayed by every deploy — see Harnesses and golden vectors.