code wiki / (root) / nx_search_sota_research.nx

nx_search_sota_research.nx source

↩ module page · 56 lines · 3671 B

1// nx_search_sota_research.nx -- third grounding pass (operator 2026-07-03: "make sure using the nishi 2// researcher and census ... that we are state of the art"). Banks the engines CLOSEST to our embedded 3// no-server profile (Tantivy, SQLite FTS5, Lucene) + the relevance-EVALUATION canon (nDCG/MRR -- SOTA 4// is a MEASURED quality, not a feature checklist) + query-language references (boolean ops, stemming). 5// Sovereign TLS-1.3 -> knowledge/library/sota_*. Tolerates partial (>=5/8). license_tier: ORIGINAL 6import "nx_syscalls.nx" 7import "nx_x509_trust_store.nx" 8import "nx_trust_store_load_from_certdata.nx" 9import "nx_https_fetch_follow.nx" 10const K_MAGIC_4194304: i64 = 4194304 11const K_MAGIC_8388608: i64 = 8388608 12 13func so_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 14func so_n(v: i64) -> i64 { 15 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 16 var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 17 let d: *u8 = sys_mmap(24); var k: i64 = 0 18 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 19 let o: *u8 = sys_mmap(24); var i: i64 = 0 20 while i < k { o[i] = d[k - 1 - i]; i = i + 1 } 21 sys_write(1, o, k); return 0 22} 23func so_one(store: *TrustStore, url: *u8, path: *u8, out: *u8, cap: i64) -> i64 { 24 let status: *i64 = sys_mmap(8) as *i64 25 status[0] = 0 26 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status) 27 so_puts(" " as *u8); so_puts(url); so_puts(" -> " as *u8); so_n(status[0]); so_puts(" bytes=" as *u8); so_n(n) 28 if n > 0 { if status[0] == 200 { 29 let fd: i64 = sys_openat_wr(path, 420) 30 if fd >= 0 { sys_write(fd, out, n); sys_close(fd); so_puts(" SAVED\n" as *u8); return 1 } 31 } } 32 so_puts(" FAIL\n" as *u8) 33 return 0 34} 35 36func main() -> i64 { 37 so_puts("=== SOTA grounding pass 3 (embedded engines + relevance-eval canon) ===\n" as *u8) 38 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304) 39 if r <= 0 { so_puts("certdata load failed\n" as *u8); return 1 } 40 let store: *TrustStore = r as *TrustStore 41 let cap: i64 = K_MAGIC_8388608 42 let out: *u8 = sys_mmap(cap) 43 var landed: i64 = 0 44 landed = landed + so_one(store, "https://raw.githubusercontent.com/quickwit-oss/tantivy/main/README.md" as *u8, "knowledge/library/sota_tantivy.md" as *u8, out, cap) 45 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Apache_Lucene" as *u8, "knowledge/library/sota_lucene.html" as *u8, out, cap) 46 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/SQLite" as *u8, "knowledge/library/sota_sqlite.html" as *u8, out, cap) 47 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Discounted_cumulative_gain" as *u8, "knowledge/library/sota_ndcg.html" as *u8, out, cap) 48 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Mean_reciprocal_rank" as *u8, "knowledge/library/sota_mrr.html" as *u8, out, cap) 49 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Stemming" as *u8, "knowledge/library/sota_stemming.html" as *u8, out, cap) 50 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Full-text_search" as *u8, "knowledge/library/sota_fulltext.html" as *u8, out, cap) 51 landed = landed + so_one(store, "https://en.wikipedia.org/wiki/Boolean_model_of_information_retrieval" as *u8, "knowledge/library/sota_boolean.html" as *u8, out, cap) 52 so_puts("=== landed " as *u8); so_n(landed); so_puts("/8 ===\n" as *u8) 53 if landed >= 5 { so_puts("SOTA-RESEARCH GREEN\n" as *u8); return 0 } 54 so_puts("SOTA-RESEARCH RED\n" as *u8) 55 return 1 56}