code wiki / _hdl_build / _wiki_search_gate.nx

_wiki_search_gate.nx

buildroot/runtime/_hdl_build/_wiki_search_gate.nx

11038 B214 linesdepth 8pulls 13 transitivereach 0 importersview sourcekind gate/prooftopic wiki
docsdependenciesstructsconstsfunctions

about

_wiki_search_gate.nx -- THE RANKED-SEARCH GATE (wiki R3). Re-proves, from a REAL run (no fabricated GREEN), that the wiki's search is (1) genuinely BM25-RANKED -- ordered by term density, not mere presence -- and (2) UNIFIED with the no-link-rot archive -- content that lives only in the content-addressed archive (never in the live doc store) is still found. Rows (judged by the WIKISEARCH marker; FAIL any -> RED, never silenced): rank_ok docA mentions "sovereign" 5x, docB 1x (both same length-class). Real BM25 must rank docA STRICTLY ABOVE docB -- assert on the ranked rowid ORDER (ground truth), not a bare rc==const. A presence/AND ranker would tie them; BM25 separates them by tf. archive_ok A page whose body contains the UNIQUE term "zarquontoken" is archived into the wikiarchive store but is NOT in the live doc store. Searching "zarquontoken" must FIND it via the seg_store term index folded in by nx_wbs_gather_archive (kind=ARCHIVE). neg_ok Bogus "zzqnosuchterm" -> 0 hits across doc store AND archive. Determinism: a FRESH archive prefix keyed by the wall-clock epoch (empty store each run => idempotent re-run, Rule 10). The PRODUCTION archive prefix is knowledge/store/wikiarchive- (nx_wiki_archive). nx_sites_daemon UNTOUCHED. Verdict line (stdout + knowledge/status/wiki_search_gate.log): WIKISEARCH results=<n> rank_ok=<0|1> archive_ok=<0|1> neg_ok=<0|1> verdict=GREEN|RED Pure NishiLang, NO SQL, NO .sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_seg_store.nx nx_wiki_archive.nx nx_wiki_index_builder.nx nx_wiki_bm25_search.nx _wiki_search_gate.nx

imports: nx_syscalls.nxnx_seg_store.nxnx_wiki_archive.nxnx_wiki_index_builder.nxnx_wiki_bm25_search.nx

imported by: nobody (leaf or entry point)

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

main wsg_p wsg_w sys_write sys_mmap wsg_cat wsg_catn sys_mmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real nx_wiki_doc_store_init sys_mmap ↻ wsg_pn wsg_n sys_mmap ↻ sys_write ↻ nx_wiki_doc_store_add sys_mmap ↻ nx_wib_pool_alloc wsg_slen nx_wiki_doc_store_count ss_begin ss_begin_cap sys_mmap ↻ war_archive_page war_cid_of_body cid_of sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_final blk_set_byte ↻

structs

none

consts

33const WSG_LOG: *u8 = "knowledge/status/wiki_search_gate.log"

functions

36func wsg_w(fd: i64, s: *u8) -> i64
called by 2: wsg_w2wsg_p calls 1: sys_write
42func wsg_n(fd: i64, v: i64) -> i64
called by 2: wsg_n2wsg_pn calls 2: sys_mmapsys_write
56func wsg_w2(lfd: i64, s: *u8) -> i64 { wsg_w(1, s); if lfd >= 0 { wsg_w(lfd, s) } return 0 }
called by 1: main calls 1: wsg_w
57func wsg_n2(lfd: i64, v: i64) -> i64 { wsg_n(1, v); if lfd >= 0 { wsg_n(lfd, v) } return 0 }
called by 1: main calls 1: wsg_n
58func wsg_p(s: *u8) -> i64 { wsg_w(1, s); return 0 }
called by 1: main calls 1: wsg_w
59func wsg_pn(v: i64) -> i64 { wsg_n(1, v); return 0 }
called by 1: main calls 1: wsg_n
60func wsg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
63func wsg_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
68func wsg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
81func main() -> i64