nx_search_linear.nx
buildroot/runtime/nx_search_linear.nx
about
nx_search_linear.nx -- substring search over JSONL catalogs.
module: nishi-core.search.linear
depends: nishi-core.io.syscalls
disk_kb: 4
capability: CORE_IO
wired_status: FULLY_WIRED
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: linear_scan_grep_tradition +
tfidf_information_retrieval_salton_1971 +
nishi_build_the_system_cardinal_2026
Bits-up "search engine" Brick #1: linear scan with substring
matching + TF-style score (count of query occurrences in each row).
O(N * M) where N = file size, M = query length. Adequate for
up to ~1M-row JSONL catalogs at <1s qemu-rv64 / <50ms native.
Future: inverted-index primitive over the same JSONL (queued as
nx_search_inverted) for sub-millisecond random access at scale.
This primitive composes against any JSONL catalog produced by
nx_ingest_batch -- including but not limited to fixtures/gbif_bulk/
ingested_bulk.jsonl (10K+ GBIF Backbone Taxonomy records).
dependencies 1 imports · 1 importers
imports: syscalls.nx
imported by: nx_search_linear_test.nx
structs
| 45 | struct NxSearchMatch |
| 58 | struct NxSearchReport |
consts
| 30 | const NX_SEARCH_OK: i64 = 1 |
| 31 | const NX_SEARCH_FILE_NOT_FOUND: i64 = 2 |
| 32 | const NX_SEARCH_NO_MATCHES: i64 = 3 |
| 33 | const NX_SEARCH_BAD_ARGS: i64 = 4 |
| 54 | const NX_SEARCH_MATCH_BYTES: i64 = 48 // 6 fields * 8 bytes |
| 68 | const NX_SEARCH_REPORT_BYTES: i64 = 56 // 7 fields * 8 bytes |
| 72 | const NX_SEARCH_MAX_SCAN_BYTES: i64 = 4294967296 // 4 GiB |
functions
| 35 | func nx_search_verdict_name(v: i64) -> *u8 |
| 74 | func nx_search_count_substring_in_range( called by 1: nx_search_linear_search |
| 116 | func nx_search_linear_search( |
| 219 | func nx_search_match_at(matches: *NxSearchMatch, idx: i64) -> *NxSearchMatch called by 1: main |