code wiki / _hdl_build / nx_wiki_search_page.nx

nx_wiki_search_page.nx

buildroot/runtime/_hdl_build/nx_wiki_search_page.nx

8223 B102 linesdepth 10pulls 24 transitivereach 0 importersview sourcekind tooltopic wiki
docsdependenciesstructsconstsfunctions

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

nx_ims_page.nx nx_itoa_lib.nx nx_wiki_answer.nx nx_wiki_search_page.nx

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

main wsp_cat wsp_card wa_new answer answer_ex wa_strlen sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close wa_lookup_site wa_streq nx_inv_load sys_read_file ↻ nx_inv_is_token_char nx_inv_query_term nx_inv_hash_bytes_lower nx_inv_lookup_slot nx_inv_slot_at nx_inv_slot_hash nx_inv_slot_postings_count nx_inv_slot_postings_offse nx_inv_slot_write_cursor wa_fold bmf_score re_count re_strlen bmf_contrib bmf_df re_count ↻ bm_idf_micro bm_ln_micro wa_read_threshold sys_read_file ↻ wa_strlen ↻ nx_search_query_init sys_mmap ↻

structs

none

consts

22const WSP_BODY_CAP: i64 = 65536 // body_html scratch (>> the few KB this page needs)

functions

24func 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 }
called by 2: wsp_cardmain
29func wsp_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
32func 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 }
called by 2: wsp_cardmain
34func 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
35func 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
40func wsp_card(dst: *u8, off: i64, query: *u8) -> i64
68func main() -> i64