code wiki / (root) / nx_docprose.nx

nx_docprose.nx

buildroot/runtime/nx_docprose.nx

15265 B329 linesdepth 3pulls 4 transitivereach 40 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_docprose.nx -- LIB: WHERE DOES A STORED DOCUMENT'S REAL CONTENT BEGIN? THE DEFECT THIS EXISTS TO REMOVE, MEASURED LIVE ON nishifamily.com/search 2026-08-25 (site scope, one result page): results were rendered with these as their TITLES -- "HTTP/1.1 200 OK Date: Thu, 02 Jul 2026 17:07:07 GMT Content-Type: text/h" "<p align=\"center\">" The renderer was not at fault: it faithfully took "the first non-empty LINE", and the first line of those stored documents really IS an HTTP status line / a raw markup tag, because the evidence-mirror captures in knowledge/fetched are indexed as documents with their wire bytes intact. ROOT vs REACH -- STATED PLAINLY SO NOBODY MISREADS THIS LIB'S SCOPE: The ROOT fix is at INGEST (derive clean text before indexing; nx_block_density's bd_fit_text is the estate's shipping boilerplate remover and is the organ for that job). This lib is the SERVE-SIDE half, and it is NOT a workaround: it repairs the ALREADY-INDEXED corpus with no reindex, and it stays correct afterwards as defence in depth. An ingest fix alone leaves every existing document broken until a full reindex; a serve fix alone leaves the stored text dirty for every other consumer. Both are owed and both are real. POLICY IS CONF, STRUCTURE IS CODE. The protocol facts (an HTTP header block ends at the first blank line, RFC 9112 2.1) are code. The one judgement call -- how many letters make a "word" -- is a conf row. license_tier: ORIGINAL

dependencies 3 imports · 4 importers

nx_syscalls.nx nx_lane_conf.nx nx_textcut.nx nx_docprose.nx nx_docportal_lib.nx nx_docportal_search_serve.nx nx_docportal_search_serve_snip_202 nx_docprose_gate.nx

imports: nx_syscalls.nxnx_lane_conf.nxnx_textcut.nx

imported by: nx_docportal_lib.nxnx_docportal_search_serve.nxnx_docportal_search_serve_snip_20260912.nxnx_docprose_gate.nx

structs

none

consts

26const DPR_CONF: *u8 = "knowledge/docprose.conf"
31const DPR_DEF_TITLE_MIN_WORDRUN: i64 = 2
38const DPR_DEF_TITLE_SCAN_BYTES: i64 = 8000
40const DPR_CH_LF: i64 = 10
41const DPR_CH_CR: i64 = 13
42const DPR_CH_SP: i64 = 32
43const DPR_CH_DASH: i64 = 45
44const DPR_CH_COLON: i64 = 58
45const DPR_CH_LT: i64 = 60
46const DPR_HTTPSIG_N: i64 = 5 // len("HTTP/") -- DERIVED beside the literal it measures, never hand-counted apart from it

functions

59func dpr_conf_one(key: *u8, dflt: i64) -> i64
called by 1: dpr_load_conf calls 1: lc_geti
65func dpr_load_conf() -> i64
73func dpr_conf_reset() -> i64 { dpr_conf_loaded_g = 0; return 0 }
74func dpr_last_http_skipped() -> i64 { return dpr_last_http_skipped_g }
called by 1: main
75func dpr_last_lines_skipped() -> i64 { return dpr_last_lines_skipped_g }
called by 1: main
76func dpr_last_budget_hit() -> i64 { return dpr_last_budget_hit_g }
80func dpr_last_degraded() -> i64 { return dpr_last_degraded_g }
86func dpr_http_body(txt: *u8, n: i64) -> i64
140func dpr_line_end(txt: *u8, n: i64, off: i64) -> i64
152func dpr_is_markup_line(txt: *u8, n: i64, s: i64, e: i64) -> i64
called by 2: dpr_content_startmain calls 1: tc_skip_ws
159func dpr_is_namech(c: i64) -> i64
called by 1: dpr_is_header_line calls 1: tc_is_wordch
168func dpr_is_header_line(txt: *u8, n: i64, s: i64, e: i64) -> i64
called by 2: dpr_content_startmain calls 1: dpr_is_namech
197func dpr_max_wordrun(txt: *u8, s: i64, e: i64) -> i64
called by 1: dpr_title calls 1: tc_is_wordch
220func dpr_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: dpr_find_ci
223func dpr_find_ci(txt: *u8, from: i64, to: i64, pat: *u8) -> i64
called by 2: dpr_http_bodydpr_is_html calls 1: dpr_lc
240func dpr_is_html(txt: *u8, n: i64) -> i64
262func dpr_content_start(txt: *u8, n: i64) -> i64
298func dpr_title(txt: *u8, n: i64, cap: i64, offout: *i64, lenout: *i64, exactbox: *i64) -> i64