code wiki / _hdl_build / nx_wiki_search_page.nx
nx_wiki_search_page.nx
buildroot/runtime/_hdl_build/nx_wiki_search_page.nx
about
nx_wiki_search_page.nx -- GENERATE the live "/wiki/search.html" instant-answer page (IMS Thrust B).
A walkable Diataxis REFERENCE page built through the reusable typed generator nx_ims_page (full walk
furniture: head/nav/breadcrumb/tree/prev-next/related/backlinks/infobox/toc/footer, nav model read from
wiki_links.tsv by slug=search). The page's OWN content (body_html) is:
1. a search box (GET form -> /wiki/search.html?q=...) -- the same form the site nav already exposes,
2. an INSTANT-ANSWER CARD section: for 3 representative queries we call the FIXED answer organ
(nx_wiki_answer.answer) AT BUILD TIME and embed the returned snippet + the CORRECT source link,
3. a short "how it works" note (registry-driven BM25F + densest-cluster snippet + NO_ANSWER teeth).
This demonstrates the instant-answer card end-to-end with REAL output (not hand-written): the snippet is
produced by nx_search_snippet_extract (already html-escaped + <mark>-highlighted, safe to embed) and the
source link is base_url+slug.html exactly as the answer organ resolves it. STATIC page (the answer is
rendered at build time for the example queries); a live daemon /wiki/search route would call answer() per
request -- noted in the page itself. ADDITIVE: writes web_assets/search.html only.
REUSE (nothing reinvented): nx_ims_page ims_page (the typed walkable generator) + nx_wiki_answer answer/
wa_new/WaAnswer (the fixed instant-answer engine). license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_ims_page.nxnx_itoa_lib.nxnx_wiki_answer.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const WSP_BODY_CAP: i64 = 65536 // body_html scratch (>> the few KB this page needs) |
functions
| 24 | func wsp_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 29 | func wsp_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 32 | func wsp_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { dst[off + i] = s[i]; i = i + 1 } return off + i } |
| 34 | func wsp_catb(dst: *u8, off: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { dst[off + i] = s[i]; i = i + 1 } return off + i } called by 1: wsp_card |
| 35 | func wsp_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: wsp_card |
| 40 | func wsp_card(dst: *u8, off: i64, query: *u8) -> i64 |
| 68 | func main() -> i64 |