code wiki / _hdl_build / nx_prefix.nx
nx_prefix.nx
buildroot/runtime/_hdl_build/nx_prefix.nx
about
nx_prefix.nx -- R-UX-3 of the onsite-search S-class ladder: SOVEREIGN instant / as-you-type prefix
autocomplete (LIBRARY). Typing "div" should instantly suggest "divorce" (cited srch_elastic.raw: autocomplete).
Sorted vocab + binary-search lower bound -> the matching terms are a CONTIGUOUS run, so suggest is O(log n + k),
not O(n) -- that's what makes it "instant" at vocab scale. Deterministic, integer, no third party.
exports: vr_prefix_match, vr_prefix_lower, vr_prefix_collect. license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_gallery_serve.nxnx_prefix_gate.nxnx_vocab_extract.nx
structs
| none |
consts
| none |
functions
| 9 | func px_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 12 | func vr_prefix_match(term: *u8, pre: *u8, pl: i64) -> i64 called by 1: vr_prefix_collect |
| 19 | func px_cmp_pre(a: *u8, pre: *u8, pl: i64) -> i64 called by 1: vr_prefix_lower |
| 33 | func vr_prefix_lower(terms: *i64, n: i64, pre: *u8, pl: i64) -> i64 |
| 44 | func vr_prefix_collect(terms: *i64, n: i64, pre: *u8, pl: i64, out: *i64) -> i64 |