code wiki / _hdl_build / nx_site_search.nx

nx_site_search.nx

buildroot/runtime/_hdl_build/nx_site_search.nx

7918 B130 linesdepth 5pulls 5 transitivereach 1 importersview sourcekind librarytopic site
docsdependenciesstructsconstsfunctions

about

nx_site_search.nx -- the live /search ENDPOINT handler for a public site (operator: wire the live /search). PURE bytes-in/bytes-out (sr_handle, the nx_status_daemon pattern -- the gate drives it in-process, no socket): on GET /search?q=<terms> it loads the site's PERSISTED onsite index + manifest (the SAME nx_search_inverted_persist the proven nx_onsite_search CLI uses), unions the matching docs, and renders a branded results page whose links are the canonical /practice/<slug> URLs (which the data-driven pages from nx_site_pages now resolve). Composes the existing search engine -- no new ranking math. Wiring it as the GET /search route in the sites daemon is the deploy step. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_search_inverted_persist.nx nx_syscalls.nx nx_site_search.nx nx_site_search_gate.nx

imports: nx_search_inverted_persist.nxnx_syscalls.nx

imported by: nx_site_search_gate.nx

structs

none

consts

10const SR_MAGIC_262144: i64 = 262144
12const SR_MAX_TERMS: i64 = 8
13const SR_ROWID_CAP: i64 = 16384

functions

15func sr_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 2: sr_respsr_handle
16func sr_catn(out: *u8, o: i64, v: i64) -> i64
called by 2: sr_respsr_handle calls 1: sys_mmap
22func sr_hexnib(c: i64) -> i64 { if c >= 48 { if c <= 57 { return c - 48 } } if c >= 97 { if c <= 102 { return c - 87 } } if c >= 65 { if c <= 70 { return c - 55 } } return 0 - 1 }
called by 1: sr_query
25func sr_query(req: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 1: sr_handle calls 1: sr_hexnib
48func sr_resp(out: *u8, body: *u8, bo: i64) -> i64
called by 1: sr_handle calls 2: sr_catsr_catn
57func sr_handle(req: *u8, n: i64, idx_path: *u8, manifest_path: *u8, base_url: *u8, firm: *u8, out: *u8) -> i64