nx_search_render_html.nx
buildroot/runtime/hub/nx_search_render_html.nx
about
nx_search_render_html.nx -- HUB primitive; site-agnostic HTML render
of NxSearchResults. Operator cardinal: "make sure you make the onsite
and offsite search reusable and not just tied to the wiki but with
capabilities to be used on other sites" (2026-05-27).
COMPOSES (per NISHI_SMALL_SHARP_COMPOSABLE_STANDARD §4.1 M3 + M7):
hub/nx_search_query_parser (NxSearchQuery)
nx_search_onsite_engine (NxSearchResults)
nx_search_snippet_extract (snippet w/ <mark>)
nx_html_escape (html_escape)
COMPOSED BY:
hub/nx_search_handler_flow (next commit; site-agnostic HTTP flow)
wiki/nx_wiki_search_wiring (next; THIN wiki adapter)
(future) obd-config/nx_obd_search_wiring (THIN obd-config adapter)
(future) sprinkler-config search wiring
any site rendering search results
DESIGN PRINCIPLE (per operator cardinal 2026-05-27):
- Emits to RAW BYTE BUFFER (out + cap + *off) -- NOT to any
site-specific writer struct. Reusable across wiki, obd-config,
sprinkler-config, third-party-hosted Nishi pages.
- Per-site CSS classes are PARAMETERIZED via NxSearchRenderTheme
(site picks wiki-result vs obd-result vs sprinkler-result).
- Per-result data (title/url/body) passed inp via parallel arrays
(NxSearchRenderInputs) -- site provides whatever its doc store
returns; render emits structure.
V1 SCOPE per NISHI_SEARCH_CHARTER.md §6:
- Sealed render: results banner + per-result card + empty state
- QoS observable (elapsed_us per Cardinal 18)
- Defensive at boundary: null title/url/body render explicitly
V2 SCOPE (TODO):
- Faceted filters sidebar (when nx_search_facets ships)
- Pagination controls
- "Did you mean?" suggestions
- Per-result archive-snapshot link (when nx_archive ships)
Status: V1. 2026-05-27.
dependencies 5 imports · 3 importers
imports: nx_syscalls.nxnx_search_query_parser.nxnx_search_onsite_engine.nxnx_search_snippet_extract.nxnx_html_escape.nx
imported by: nx_search_handler_flow.nxnx_wiki_search_render.nxnx_wiki_search_wiring.nx
structs
| 73 | struct NxSearchRenderTheme |
| 115 | struct NxSearchRenderInputs |
consts
| 49 | const NX_SRH_OK: i64 = 0 |
| 50 | const NX_SRH_BAD_INPUT: i64 = 1900 |
| 51 | const NX_SRH_OUTPUT_OVERFLOW: i64 = 1901 |
| 52 | const NX_SRH_INPUTS_MISMATCH: i64 = 1902 |
| 53 | const NX_SRH_SNIPPET_FAIL: i64 = 1903 |
| 54 | const NX_SRH_LOOP_BUDGET: i64 = 1904 |
| 55 | const NX_SRH_THEME_INVALID: i64 = 1905 |
| 58 | const NX_SRH_MAX_RESULTS_RENDER: i64 = 200 |
| 59 | const NX_SRH_SNIPPET_BUF_CAP: i64 = 2048 |
| 60 | const NX_SRH_TITLE_CAP_BYTES: i64 = 512 |
| 61 | const NX_SRH_URL_CAP_BYTES: i64 = 512 |
| 62 | const NX_SRH_LOOP_BUDGET_CAP: i64 = 1000000 |
| 63 | const NX_SRH_INT_BUF_CAP: i64 = 32 |
functions
| 89 | func nx_srh_theme_init(t: *NxSearchRenderTheme, called by 1: nx_wiki_search_theme_init |
| 126 | func nx_srh_inputs_init(inp: *NxSearchRenderInputs, called by 1: nx_search_flow_finalize_inputs |
| 150 | func nx_srh_put_raw(out: *u8, cap: i64, off: i64, |
| 163 | func nx_srh_put_z(out: *u8, cap: i64, off: i64, s: *u8) -> i64 called by 4: nx_srh_write_bannernx_srh_write_emptynx_srh_write_cardnx_search_render_html calls 1: nx_srh_put_raw |
| 172 | func nx_srh_put_escaped(out: *u8, cap: i64, off: i64, |
| 183 | func nx_srh_int_to_dec(v: i64, out: *u8, cap: i64) -> i64 |
| 215 | func nx_srh_write_banner(out: *u8, cap: i64, off: i64, |
| 244 | func nx_srh_write_empty(out: *u8, cap: i64, off: i64, |
| 265 | func nx_srh_write_card(out: *u8, cap: i64, off: i64, |
| 338 | func nx_search_render_html(out: *u8, cap: i64, off: i64, |