code wiki / _hdl_build / nx_wiki_answer_index.nx
nx_wiki_answer_index.nx
buildroot/runtime/_hdl_build/nx_wiki_answer_index.nx
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
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
structs
| none |
consts
| 21 | const WAI_SRC_OUT: *u8 = "knowledge/index/wiki_answer_src.tsv" |
| 22 | const WAI_HTML_CAP: i64 = 1048576 // 1 MB per source page (>> any real page) |
| 23 | const WAI_TXT_CAP: i64 = 1048576 // scrubbed-text scratch |
| 24 | const WAI_BUF_CAP: i64 = 8388608 // 8 MB accumulated TSV (12 pages of text) |
| 25 | const WAI_MODE: i64 = 0x1a4 // 0644 |
functions
| 27 | func 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 } |
| 32 | func wai_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 33 | func 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 |
| 36 | func wai_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } |
| 40 | func wai_is_open_tag(src: *u8, n: i64, p: i64, name: *u8) -> i64 |
| 62 | func wai_is_close_tag(src: *u8, n: i64, p: i64, name: *u8) -> i64 |
| 79 | func wai_past_gt(src: *u8, n: i64, p: i64) -> i64 called by 1: wai_strip_tag |
| 90 | func wai_strip_tag(src: *u8, n: i64, dst: *u8, name: *u8) -> i64 |
| 114 | func wai_row(dst: *u8, off: i64, slug: *u8, file: *u8) -> i64 |
| 152 | func main() -> i64 |