code wiki / _hdl_build / nx_search_cli.nx
nx_search_cli.nx
buildroot/runtime/_hdl_build/nx_search_cli.nx
about
nx_search_cli.nx -- ASSIGNMENT E (tutored): the search engine's FRONT DOOR over the DURABLE index. The
harvest (nx_library_harvest_v2) proved build->persist; until now nothing user-facing QUERIED that artifact --
the index was provably correct and practically dark. This is the live path: argv terms -> load
knowledge/index/library.idx (NO rebuild: build-once-query-forever) -> inverted-index postings shortlist the
candidate docids -> docmap names their files -> the Engineer-wired bm_* BM25 ranker (x1e6 fixed-point, the
_hdl_build nx_bm25.nx that shadows runtime's on this lane) scores them -> "score path" per hit. Distinct
from nx_library_search.nx (the Researcher's IN-MEMORY corpus ranker; no main, no
persistence) -- one capability per module. BM25 stats (avgdl/IDF) are computed over the CANDIDATE set;
corpus-wide stats stored at harvest = the next rung when the corpus outgrows reading candidates whole.
Usage: nx_search_cli.sov.elf <term> [term ...] license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_search_inverted_persist.nxnx_itoa_lib.nxnx_bm25.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
| 14 | const LS_MAGIC_1000000: i64 = 1000000 |
| 15 | const LS_MAGIC_10000: i64 = 10000 |
| 17 | const LS_MAX_DOCS: i64 = 4096 |
| 18 | const LS_MAX_TERMS: i64 = 8 |
| 19 | const LS_ROWID_CAP: i64 = 1024 |
| 20 | const LS_TOP_K: i64 = 10 |
functions
| 22 | func sc_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 |
| 27 | func sc_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 28 | func sc_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 34 | func sc_fold(s: *u8, n: i64) -> i64 called by 1: main |
| 45 | func sc_score(v: i64) -> i64 |
| 58 | func sc_load_docmap(path: *u8, paths_out: *i64, cap: i64) -> i64 |
| 77 | func main(argc: i64, argv: *i64) -> i64 |