code wiki / _hdl_build / nx_research_search.nx
nx_research_search.nx
buildroot/runtime/_hdl_build/nx_research_search.nx
about
nx_research_search.nx -- CROSS-SHARD QUERY over the self-growing researcher index. The grow organ builds
append-only shards (research_0.idx, research_1.idx, ...); this is the consumption side: load every shard,
query each for the argv terms, merge the candidate docs across shards, rank by #query-terms-matched, and
print the top-K "score shard:path". Makes the grown + deduped + mined corpus actually searchable end-to-end.
Sequentially loads shards 0,1,2,... until the first gap (grow numbers them contiguously). NOTE: loading ALL
shards in one process is fine for a handful; at large shard counts this needs sys_munmap (the keystone) or a
periodic shard-merge. Usage: nx_research_search <term> [term ...] expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_search_inverted_persist.nxnx_itoa_lib.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
| 11 | const RS_TERMS: i64 = 8 |
| 12 | const RS_ROWIDS: i64 = 4096 |
| 13 | const RS_CAND: i64 = 16384 |
| 14 | const RS_TOPK: i64 = 15 |
| 15 | const RS_MAXSHARD: i64 = 4096 |
functions
| 17 | func rs_puts(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 1: main |
| 22 | func rs_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 23 | func rs_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 24 | func rs_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: main |
| 25 | func rs_catnum(dst: *u8, off: i64, v: i64) -> i64 called by 1: main |
| 34 | func rs_load_docmap(path: *u8, paths_out: *i64, cap: i64) -> i64 |
| 51 | func main(argc: i64, argv: *i64) -> i64 |