AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
docs(autoindex): correct the sectioning-cost claim, which was wrong by ~100x
xerj-orge5e74340d1a6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5c217a499..4c45bf407 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -288,8 +288,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0What replaces it is `looks_like_tga_header`: TGA has no magic number, but its18-byte header is constrained enough that bytes 1 and 2 of the file must bothbe control characters. **Headerless raw payloads (`.raw`, `.bytes`,- uncompressed PCM) still classify as text**, exactly as they do on `ca4d75a`;- bounding sectioning memory is the fix for that, and is not attempted here.+ uncompressed PCM) still classify as text**, exactly as they do on `ca4d75a`.+ Bounding what a magic-less binary costs is the fix for that and is not+ attempted here — see [#381](https://github.com/xerj-org/xerj/issues/381);+ `for_each_section` already streams, so the unbounded quantity is the record+ count, not resident memory.- **The new magic-byte signatures now require structural confirmation.** Ninesignatures (PSD, both TIFF byte orders, RIFF, OGG, FLAC, MP3, FBX and EXR)diff --git a/engine/crates/xerj-autoindex/src/sniff.rs b/engine/crates/xerj-autoindex/src/sniff.rsindex 1dd745352..6739fee30 100644--- a/engine/crates/xerj-autoindex/src/sniff.rs+++ b/engine/crates/xerj-autoindex/src/sniff.rs@@ -179,9 +179,10 @@ fn sniff_bytes(}// Compressed image/audio/model payloads routinely pass the NUL and// control-char heuristics below (windows-1252 decodes almost every byte- // to something printable), and a multi-MB PSD misread as prose costs- // ~100x its size in RAM through sectioning. Magic bytes are the reliable- // signal.+ // to something printable), and a multi-MB PSD misread as prose turns into+ // thousands of junk records — measured: a 4,194,360-byte printable blob+ // yields 2,048 sections. `for_each_section` streams, so the cost is the+ // record COUNT, not resident bytes. Magic bytes are the reliable signal.//// Every signature ADDED BY THIS BRANCH whose bytes are printable ASCII// carries a `qualify` check as well, because "starts with these letters"@@ -296,8 +297,10 @@ fn sniff_bytes(// TGA is now caught by its header above, which is evidence of pixel data// rather than evidence of a non-Latin script. Headerless raw payloads// (`.raw`, `.bytes`, uncompressed PCM) still classify as text, exactly as- // they do on `main`; bounding sectioning memory is the fix for that, not- // byte statistics that cannot tell a texture from Cyrillic.+ // they do on `main`. Bounding what a magic-less binary costs is the right+ // fix for that (issue #381 — sectioning already streams, so the unbounded+ // quantity is the record count), not byte statistics that cannot tell a+ // texture from Cyrillic.// 2b. Unity text serialization, detected by content (never extension):// scenes/prefabs/assets open with `%YAML` and declare the Unity tag@@ -881,9 +884,10 @@ mod unity_sniff_tests {}/// Regression: PSD image data decoded via lossy windows-1252 passed the- /// NUL/control-char heuristics and classified as txt-prose, turning a- /// multi-MB texture into ~100x its size of prose sections. Media magic- /// bytes must win before any text heuristic runs.+ /// NUL/control-char heuristics and classified as txt-prose, shredding a+ /// multi-MB texture into thousands of junk prose records (a 4 MB blob+ /// yields ~2,048 sections). Sectioning streams, so the cost is record+ /// count, not RAM. Media magic bytes must win before any text heuristic.#[test]fn media_containers_are_binary_by_magic_not_heuristics() {for (name, head, kind) in [