code wiki / _hdl_build / nx_wiki_answer_index.nx

nx_wiki_answer_index.nx

buildroot/runtime/_hdl_build/nx_wiki_answer_index.nx

11981 B187 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_answer_index.nx -- INDEX DRIVER for the instant-answer search over the 19-page live wiki corpus (real-tree deepened) (IMS Thrust B rung 1). Builds the "id<TAB>text" search-source TSV the reusable onsite ingestor (nx_onsite_index) consumes: one row per live wiki page (13 prior content pages + 6 batch-#2 pages; the search page itself is excluded by design), id = slug, text = the page's VISIBLE text with HTML scrubbed. REUSE not reinvent -- the HTML->text scrub is nx_html_to_text (strips tags, suppresses <script>/<style>, collapses whitespace, decodes entities) VERBATIM; the slug->web_assets file map mirrors nx_ims_corpus_refresh EXACTLY (start lives in ai_start.html, the /wiki/ econsim is econsim_wiki.html), so we index the SAME bytes vpub publishes (== what is served at https://nishifamily.com/wiki/<slug>.html). After this writes knowledge/index/wiki_answer_src.tsv, the build step runs the EXISTING ingestor: nx_onsite_index knowledge/index/wiki_answer_src.tsv https://nishifamily.com/wiki/ \ knowledge/index/wiki.idx knowledge/index/wiki.manifest which produces the durable inverted index + manifest the answer organ + onsite client read, and the committed knowledge/registry/onsite_sites.tsv row (site=wiki) points at exactly that pair. Hardcoded fixed 19-page job (no argv) so `nx_sov_build_run.elf nx_wiki_answer_index` builds AND runs it in one shot. ADDITIVE-ONLY: writes the search-source TSV; touches no live page. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_html_to_text.nx nx_wiki_answer_index.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_html_to_text.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap wai_w sys_write wai_row sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close wai_w ↻ wai_strip_tag wai_is_open_tag wai_lc wai_past_gt wai_is_close_tag wai_lc ↻ nx_html_to_text nx_html_to_text_x h2t_state_new sys_mmap ↻ sys_mmap ↻ h2t_scan_tag h2t_skip_to_gt h2t_scan_name h2t_is_name h2t_is_block_tag h2t_name_eq_lit h2t_lc h2t_lc ↻ h2t_is_suppress_tag h2t_name_eq_lit ↻ h2t_emit_newline h2t_name_eq_lit ↻ h2t_emit_raw h2t_find_href h2t_lc ↻ h2t_is_name ↻

structs

none

consts

21const WAI_SRC_OUT: *u8 = "knowledge/index/wiki_answer_src.tsv"
22const WAI_HTML_CAP: i64 = 1048576 // 1 MB per source page (>> any real page)
23const WAI_TXT_CAP: i64 = 1048576 // scrubbed-text scratch
24const WAI_BUF_CAP: i64 = 8388608 // 8 MB accumulated TSV (12 pages of text)
25const WAI_MODE: i64 = 0x1a4 // 0644

functions

27func wai_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: wai_rowmain calls 1: sys_write
32func wai_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: wai_rowmain calls 1: nxi_out
33func wai_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 1: wai_row
36func wai_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
40func wai_is_open_tag(src: *u8, n: i64, p: i64, name: *u8) -> i64
called by 1: wai_strip_tag calls 1: wai_lc
62func wai_is_close_tag(src: *u8, n: i64, p: i64, name: *u8) -> i64
called by 1: wai_strip_tag calls 1: wai_lc
79func wai_past_gt(src: *u8, n: i64, p: i64) -> i64
called by 1: wai_strip_tag
90func wai_strip_tag(src: *u8, n: i64, dst: *u8, name: *u8) -> i64
114func wai_row(dst: *u8, off: i64, slug: *u8, file: *u8) -> i64
152func main() -> i64