code wiki / _hdl_build / _wiki_search_gate.nx
_wiki_search_gate.nx
buildroot/runtime/_hdl_build/_wiki_search_gate.nx
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
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
structs
| none |
consts
| 33 | const WSG_LOG: *u8 = "knowledge/status/wiki_search_gate.log" |
functions
| 36 | func wsg_w(fd: i64, s: *u8) -> i64 |
| 42 | func wsg_n(fd: i64, v: i64) -> i64 |
| 56 | func wsg_w2(lfd: i64, s: *u8) -> i64 { wsg_w(1, s); if lfd >= 0 { wsg_w(lfd, s) } return 0 } |
| 57 | func wsg_n2(lfd: i64, v: i64) -> i64 { wsg_n(1, v); if lfd >= 0 { wsg_n(lfd, v) } return 0 } |
| 58 | func wsg_p(s: *u8) -> i64 { wsg_w(1, s); return 0 } |
| 59 | func wsg_pn(v: i64) -> i64 { wsg_n(1, v); return 0 } |
| 60 | func wsg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 63 | func wsg_cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 68 | func wsg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 81 | func main() -> i64 |