code wiki / (root) / nx_search_linear.nx

nx_search_linear.nx

buildroot/runtime/nx_search_linear.nx

8410 B221 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic search
docsdependenciesstructsconstsfunctions

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

syscalls.nx nx_search_linear.nx nx_search_linear_test.nx

imports: syscalls.nx

imported by: nx_search_linear_test.nx

structs

45struct NxSearchMatch
58struct NxSearchReport

consts

30const NX_SEARCH_OK: i64 = 1
31const NX_SEARCH_FILE_NOT_FOUND: i64 = 2
32const NX_SEARCH_NO_MATCHES: i64 = 3
33const NX_SEARCH_BAD_ARGS: i64 = 4
54const NX_SEARCH_MATCH_BYTES: i64 = 48 // 6 fields * 8 bytes
68const NX_SEARCH_REPORT_BYTES: i64 = 56 // 7 fields * 8 bytes
72const NX_SEARCH_MAX_SCAN_BYTES: i64 = 4294967296 // 4 GiB

functions

35func nx_search_verdict_name(v: i64) -> *u8
74func nx_search_count_substring_in_range(
219func nx_search_match_at(matches: *NxSearchMatch, idx: i64) -> *NxSearchMatch
called by 1: main