code wiki / _hdl_build / nx_corpus_ingest.nx
nx_corpus_ingest.nx
buildroot/runtime/_hdl_build/nx_corpus_ingest.nx
about
nx_corpus_ingest.nx -- SOVEREIGN corpus ingestion: a DIRECTORY of documents -> a domain's PUBLIC seg_store
shard, searchable at once (ss_write_seg builds .terms per segment; the store IS the index -- no tsv, no
derived artifact). This is the front door for ALL THREE nishi-search fronts (operator 2026-07-03):
library: nx_corpus_ingest knowledge/library nishifamily.com (.txt/.md -> /doc text views)
site pages: nx_corpus_ingest <pagesdir> andelinwest.com / (.html -> text + url:<cid> row,
so the SERP result links to the REAL page instead of /doc)
web: the crawler drops fetched pages in a dir -> same ingest with absolute-URL prefix rows
Mechanics: getdents64 walk (flat dir) -> .txt/.md raw, .html/.htm via nx_html_to_text (script/style
suppressed, entities decoded) -> cid = the same polynomial hash nx_dp_tsv_migrate uses (content-addressed,
idempotent) -> skip-if-already-present (re-runs are clean) -> RAW ss_add doc:<cid> (+ url:<cid>) batched
into 1MB writer segments, each committed under a FRESH segid (manifest max + 1 -- never clobbers existing
segments). license_tier: ORIGINAL
dependencies 2 imports · 13 importers
diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.
imports: nx_docportal_search_seg.nxnx_html_to_text.nx
imported by: nx_bulk_index.nxnx_cc_ingest.nxnx_cc_warc_ingest.nxnx_corpus_ingest_gate.nxnx_outlink_harvest.nxnx_page_ingest.nxnx_pagerank_build.nxnx_trusted_flag.nxnx_url_index.nxnx_web_crawl_step.nxnx_web_ingest.nxnx_web_purge_slop.nxnx_web_search_probe.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 15 | const CI_MAGIC_1125899906842597: i64 = 1125899906842597 |
| 16 | const CI_MAGIC_131072: i64 = 131072 |
| 17 | const CI_MAGIC_1024: i64 = 1024 |
| 18 | const CI_MAGIC_65536: i64 = 65536 |
| 20 | const CI_DOCCAP: i64 = 900000 // per-doc byte cap (writer segments are 1MB; a doc must fit with headroom) |
| 21 | const CI_MINDOC: i64 = 20 // skip empty-ish extractions |
| 22 | const CI_RAWCAP: i64 = 8388608 // largest raw file we read |
functions
| 24 | func ci_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 25 | func ci_num(v: i64) -> i64 |
| 34 | func ci_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 35 | func ci_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } return o + i } called by 1: ci_run |
| 38 | func ci_hash(s: *u8, n: i64) -> i64 |
| 46 | func ci_mkurlkey(cid: i64, out: *u8) -> i64 |
| 60 | func ci_ends(name: *u8, suf: *u8) -> i64 |
| 68 | func ci_contains(name: *u8, ndl: *u8) -> i64 |
| 83 | func ci_kind(name: *u8) -> i64 |
| 95 | func ci_run(dir: *u8, domain: *u8, urlprefix: *u8, counts: *i64) -> i64 |
| 203 | func main(argc: i64, argv: *i64) -> i64 |