Get startedExercises
Exercise 01: trace a search
Page actions
- View as Markdown (opens in a new tab)
- Ask ChatGPT (opens in a new tab)
- Ask Claude (opens in a new tab)
ChatGPT and Claude are third-party services. The link gives them this page's public address and a short instruction. This site records nothing.
Preview: the published page may be older or missing.
Run three real queries through the search waterfall — one the exact tier answers, one the lexicon answers, one that falls to the fold — and read the reported mode against the code.
https://docs.gurbanisoul.com/exercises/01-trace-a-search/
Goal. Predict which tier answers a query, run it, and confirm from the mode the API reports.
Needs. A local server (python3 webapp/serve.py) or the production API through the wiki’s
simulator. 30 minutes.
1. Predict
Read modes and tiers. For each query below, write down the tier
you expect and the mode string it would report:
| Query | Your prediction |
|---|---|
sat nam | |
waheguru | |
zzqxv plok |
2. Run
curl -s 'http://127.0.0.1:7777/api/search?q=sat%20nam&limit=3' | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d["mode"], len(d["results"]))'curl -s 'http://127.0.0.1:7777/api/search?q=waheguru&limit=3' | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d["mode"], len(d["results"]))'curl -s 'http://127.0.0.1:7777/api/search?q=zzqxv%20plok&limit=3' | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d["mode"], len(d["results"]))'Expected output (the second line’s term in brackets may differ by dataset):
variant-match 3seeker-lexicon (vaahiguroo) 3roman-spelling-tolerant 03. Read the code
Open webapp/sggs/search.py and find do_search. For each query, find the line that set the
mode you saw. Then answer:
- Why did
sat namskip the transliteration tier? (Hint: what does thetranslitcolumn hold for the line whose transliteration issat naam?) - Why is the last query’s mode a fold tier with zero results, rather than
NOT_FOUND?
Self-check
Sri Guru Granth Sahib Ji — Knowledge Base wiki. Generated from commit c3d9360. Updated 25 September 2026. This copy may be out of date; the page is at https://docs.gurbanisoul.com/exercises/01-trace-a-search/