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(config): make the "docs site is corrected too" claim true, and guard it
xerj-org283781cd6820
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d7ba4b1ca..3853b5a66 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0stops running, if a fuzz target ships without a seed corpus, or if the"all input parsing paths" overclaim reappears in any prose file.- The claim itself is now specific about what is and is not covered.+ - **Known gap, stated because the point of this entry is not to overclaim+ again:** seven harnesses are seven parsers, not the engine's whole input+ surface, and one parser outside them is already known to abort.+ `aggs::parse_time_zone_offset` slices a `time_zone` string at byte 2 after+ a *byte*-length check, so a `date_histogram` with `"time_zone": "+中a"` in+ an unauthenticated `_search` body dies on a character boundary. It is+ pre-existing, is not touched by this change, and is tracked in+ [#272](https://github.com/xerj-org/xerj/issues/272) with a fix and a+ proposed harness for the aggregation date parsers.- **Fixed two high-severity advisories in the document-ingest XML parser.**Turning the audit gate on found `quick-xml` 0.36.2 in `xerj-autoindex`, which@@ -72,8 +81,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0xerj.toml`, the documented first step, silently changed four engine behavioursincluding turning on 8-bit vector quantization. The file is corrected and`shipped_default_config_documents_the_real_defaults` now diffs every leaf key- against `Config::default()`, so it cannot drift again. The docs site carried- the same four stale defaults and is corrected too.+ against `Config::default()`, so it cannot drift again.++- **The docs site had drifted the same way, and now has the same guard.**+ `landing/docs/config.html` shipped `wal_max_size_mb = 512`,+ `flush_size_mb = 256` and `default_quantization = "scalar8"` in its+ copy-pasteable `[storage]` and `[vector]` blocks while its own DEFAULT+ table — thirty lines up, on the same page — said 1024, 512 and `"none"`;+ `landing/docs/storage.html` said the WAL rolls at 512 MiB;+ `landing/docs/vectors.html` called `scalar8` "the default" and listed a+ `scalar4` mode that no config or mapping value can reach; and+ `engine/README.md` put `flush_size_mb` at 256 MiB. All four are corrected.+ A second guard, `the_docs_site_config_page_agrees_with_the_real_defaults`,+ now diffs *both* halves of that page — every DEFAULT cell in the reference+ table and every assignment in the example blocks — against+ `Config::default()`. An example that deliberately differs (the blocks whose+ point is switching TLS or cluster mode on) has to carry `# not a default` on+ the line, so the reader is told as well as the test.- **Four other claims from [#207](https://github.com/xerj-org/xerj/issues/207)now match the source.**diff --git a/engine/README.md b/engine/README.mdindex d654a89ef..b0c7bb07d 100644--- a/engine/README.md+++ b/engine/README.md@@ -236,7 +236,7 @@ data/schema.json Field mapping definition```-Documents are written to the WAL and an in-memory memtable first. The memtable is flushed to a durable segment when it exceeds `flush_size_mb` (default 256 MiB) or `flush_interval_secs` (default 30 s). Segments are periodically merged in the background.+Documents are written to the WAL and an in-memory memtable first. The memtable is flushed to a durable segment when it exceeds `flush_size_mb` (default 512 MiB) or `flush_interval_secs` (default 30 s). Segments are periodically merged in the background.## Securitydiff --git a/engine/crates/xerj-common/src/config.rs b/engine/crates/xerj-common/src/config.rsindex f02362052..ef0a33329 100644--- a/engine/crates/xerj-common/src/config.rs+++ b/engine/crates/xerj-common/src/config.rs@@ -1740,6 +1740,180 @@ mod tests {);}+ /// Undo the four HTML entities the docs pages actually use.+ fn html_unescape(s: &str) -> String {+ s.replace(""", "\"")+ .replace("'", "'")+ .replace("<", "<")+ .replace(">", ">")+ .replace("&", "&")+ }++ /// Render a serialised default the way `config.html` writes it: strings+ /// quoted, empty arrays as `[]`, numbers and bools bare.+ fn as_documented(value: &serde_json::Value) -> String {+ match value {+ serde_json::Value::String(s) => format!("\"{s}\""),+ serde_json::Value::Array(items) if items.is_empty() => "[]".to_string(),+ other => other.to_string(),+ }+ }++ /// The reference table on `landing/docs/config.html`, as+ /// `(section, key, documented default)` in page order.+ fn docs_default_table(page: &str) -> Vec<(String, String, String)> {+ const GROUP: &str = "<div class=\"group\" id=\"";+ const CELL_K: &str = "<div class=\"cell k\">";+ const CELL_D: &str = "<div class=\"cell d\">";++ let mut rows = Vec::new();+ let mut section = String::new();+ let mut rest = page;+ loop {+ let group_at = rest.find(GROUP);+ let key_at = rest.find(CELL_K);+ let take_group = match (group_at, key_at) {+ (Some(g), Some(k)) => g < k,+ (Some(_), None) => true,+ _ => false,+ };+ if take_group {+ let after = &rest[group_at.unwrap() + GROUP.len()..];+ let (id, tail) = after.split_once('"').expect("group id must be quoted");+ section = id.to_string();+ rest = tail;+ } else if let Some(k) = key_at {+ let after = &rest[k + CELL_K.len()..];+ let (key, tail) = after.split_once("</div>").expect("cell k must close");+ let d = tail+ .find(CELL_D)+ .expect("every key cell has a default cell");+ let (default, tail) = tail[d + CELL_D.len()..]+ .split_once("</div>")+ .expect("cell d must close");+ rows.push((+ section.clone(),+ key.trim().to_string(),+ html_unescape(default).trim().to_string(),+ ));+ rest = tail;+ } else {+ return rows;+ }+ }+ }++ /// Split `"batched" # durability knob` into value and comment, without+ /// mistaking a `#` inside a quoted string for the comment marker.+ fn split_value_and_comment(rhs: &str) -> (&str, &str) {+ let rhs = rhs.trim();+ let end = if let Some(inner) = rhs.strip_prefix('"') {+ inner.find('"').map(|i| i + 2).unwrap_or(rhs.len())+ } else {+ rhs.find('#').unwrap_or(rhs.len())+ };+ let (value, comment) = rhs.split_at(end);+ (value.trim(), comment.trim())+ }++ /// The docs site is the *other* copy of the defaults, and it drifted+ /// exactly the way `xerj.default.toml` did (#207).+ ///+ /// `landing/docs/config.html` shipped `wal_max_size_mb = 512`,+ /// `flush_size_mb = 256` and `default_quantization = "scalar8"` in its+ /// copy-pasteable `[storage]` and `[vector]` blocks while its own DEFAULT+ /// table — thirty lines above, on the same page — said 1024, 512 and+ /// `"none"`. An operator pasting the `[vector]` block switched on 8-bit+ /// quantization and its 1–2% recall loss without asking for it.+ /// `shipped_default_config_documents_the_real_defaults` did not catch it+ /// because it only reads the TOML, so read the page too:+ ///+ /// 1. every DEFAULT cell in the reference table must equal+ /// `Config::default()`, and+ /// 2. every assignment in an example block must equal the real default —+ /// unless its comment says `not a default`, which is how the blocks+ /// that exist to *turn something on* (TLS, cluster, embedding) declare+ /// themselves to the reader as well as to this test.+ #[test]+ fn the_docs_site_config_page_agrees_with_the_real_defaults() {+ let page = include_str!("../../../../landing/docs/config.html");+ let defaults = serde_json::to_value(Config::default()).unwrap();+ let table = docs_default_table(page);+ assert!(+ table.len() > 40,+ "only parsed {} rows out of the config.html reference table — the page's \+ markup changed and this guard is no longer reading it",+ table.len()+ );++ let mut drift: Vec<String> = Vec::new();+ for (section, key, documented) in &table {+ match defaults.get(section).and_then(|s| s.get(key)) {+ None => drift.push(format!(+ "table: [{section}] {key} is documented but is not a key in Config"+ )),+ Some(actual) => {+ let real = as_documented(actual);+ if &real != documented {+ drift.push(format!(+ "table: [{section}] {key} says {documented}, code says {real}"+ ));+ }+ }+ }+ }++ for block in page.split("<pre class=\"code\">").skip(1) {+ let block = html_unescape(block.split("</pre>").next().unwrap_or_default());+ let mut section = String::new();+ for line in block.lines() {+ let line = line.trim();+ if line.starts_with('#') {+ continue;+ }+ if let Some(name) = line.strip_prefix('[').and_then(|l| l.strip_suffix(']')) {+ section = name.to_string();+ continue;+ }+ let Some((key, rhs)) = line.split_once('=') else {+ continue;+ };+ let key = key.trim();+ if section.is_empty()+ || key.is_empty()+ || !key+ .bytes()+ .all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'_')+ {+ continue;+ }+ let Some(actual) = defaults.get(§ion).and_then(|s| s.get(key)) else {+ drift.push(format!(+ "example: [{section}] {key} is not a key in Config — a reader pasting \+ this block gets `unknown field` and no server"+ ));+ continue;+ };+ let (value, comment) = split_value_and_comment(rhs);+ let real = as_documented(actual);+ if value != real && !comment.contains("not a default") {+ drift.push(format!(+ "example: [{section}] {key} = {value} contradicts the real default \+ {real} and does not say so — add `# not a default ({real})` to the \+ line if the example means it"+ ));+ }+ }+ }++ assert!(+ drift.is_empty(),+ "landing/docs/config.html disagrees with Config::default() in {} place(s):\n {}",+ drift.len(),+ drift.join("\n ")+ );+ }+/// `merge.strategy = "log_structured"` used to parse, validate and then run/// size-tiered merging anyway — nothing in the tree reads the field (#207)./// An operator who picks a levelled policy for its read amplification mustdiff --git a/landing/docs/config.html b/landing/docs/config.htmlindex 3450b5202..d171aeab3 100644--- a/landing/docs/config.html+++ b/landing/docs/config.html@@ -124,7 +124,7 @@<p>Paths for the config are, in precedence order: <code class="inline">--config /path/to/xerj.toml</code> on the command line, then <code class="inline">/etc/xerj/xerj.toml</code>, then <code class="inline">./xerj.toml</code> in the working directory. If none exist, the full default is used.</p><h2>Full key table</h2>- <div class="cfg"><div class="head">KEY</div><div class="head">TYPE</div><div class="head">DEFAULT</div><div class="head">DESCRIPTION</div><div class="group" id="server">[server]</div><div class="cell k">rest_port</div><div class="cell t">u16</div><div class="cell d">8080</div><div class="cell dsc">Native REST API listener port. All native endpoints (/v1/*) live here.</div><div class="cell k">grpc_port</div><div class="cell t">u16</div><div class="cell d">8081</div><div class="cell dsc">Reserved for a future gRPC API. Not wired in v0.1 — leave at default.</div><div class="cell k">es_compat_port</div><div class="cell t">u16</div><div class="cell d">9200</div><div class="cell dsc">Elasticsearch-compatible wire port. Point Kibana, Logstash, or the ES client here. Set to 0 to disable.</div><div class="cell k">bind_address</div><div class="cell t">string</div><div class="cell d">"0.0.0.0"</div><div class="cell dsc">Interface to bind every listener to. Use "127.0.0.1" for dev or a private address in production.</div><div class="cell k">data_dir</div><div class="cell t">path</div><div class="cell d">"./data"</div><div class="cell dsc">Root for indices, WAL files, and segments. Needs fast I/O and enough free space.</div><div class="group" id="auth">[auth]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Require an API key on every request. Set to false only on a trusted network.</div><div class="cell k">admin_api_key</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Static admin key. Left empty, a 256-bit key is generated on first run and written to <data_dir>/admin.key.</div><div class="group" id="tls">[tls]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Terminate TLS at the server. Requires cert_path + key_path. If you terminate at a proxy, leave false.</div><div class="cell k">cert_path</div><div class="cell t">path</div><div class="cell d">""</div><div class="cell dsc">PEM X.509 certificate. Use a CA-signed cert in production.</div><div class="cell k">key_path</div><div class="cell t">path</div><div class="cell d">""</div><div class="cell dsc">PEM private key. Permissions should be 0600.</div><div class="group" id="storage">[storage]</div><div class="cell k">wal_sync</div><div class="cell t">enum</div><div class="cell d">"batched"</div><div class="cell dsc">"sync" · "batched" · "async". Durability vs throughput. Batched is the recommended default.</div><div class="cell k">wal_batch_ms</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Fsync cadence when wal_sync="batched" (ms). Range 1–10000. Lower = smaller loss window.</div><div class="cell k">wal_max_size_mb</div><div class="cell t">u32</div><div class="cell d">1024</div><div class="cell dsc">WAL rollover threshold (MiB). Larger means fewer rollovers, longer crash recovery.</div><div class="cell k">flush_size_mb</div><div class="cell t">u32</div><div class="cell d">512</div><div class="cell dsc">Memtable buffer size that triggers a segment flush (MiB).</div><div class="cell k">flush_interval_secs</div><div class="cell t">u32</div><div class="cell d">30</div><div class="cell dsc">Maximum wall-clock interval between flushes even if the buffer is not full.</div><div class="group" id="merge">[merge]</div><div class="cell k">strategy</div><div class="cell t">enum</div><div class="cell d">"size_tiered"</div><div class="cell dsc">Only "size_tiered" is implemented; "log_structured" is refused at startup rather than silently running the other policy.</div><div class="cell k">min_segments</div><div class="cell t">u32</div><div class="cell d">10</div><div class="cell dsc">Accepted and validated (must be ≥ 2) but <strong>not wired</strong>: the merge trigger is per-tier and comes from min_merge_count. Setting it away from the default logs a warning at startup.</div><div class="cell k">max_segment_mb</div><div class="cell t">u32</div><div class="cell d">8192</div><div class="cell dsc">Upper bound on a mergeable segment (MiB). Segments at or above this size are never merged again.</div><div class="cell k">io_rate_mb_per_sec</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Accepted but <strong>not wired</strong>: merge I/O is not throttled in this build — the rate limiter that honours it sits in an unused storage-crate merge executor. Setting it away from the default logs a warning at startup.</div><div class="cell k">max_concurrent</div><div class="cell t">u8</div><div class="cell d">1</div><div class="cell dsc">Accepted but <strong>not wired</strong>: merge parallelism comes from the XERJ_MERGE_PARALLELISM environment variable, which also defaults to 1. Setting it away from the default logs a warning at startup.</div><div class="group" id="compression">[compression]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Block-level compression. Disabling increases disk usage and lowers read CPU.</div><div class="cell k">level</div><div class="cell t">enum</div><div class="cell d">"balanced"</div><div class="cell dsc">"fast" (LZ4), "balanced" (Zstd L3, default), "best" (Zstd L19, cold storage).</div><div class="cell k">block_size_docs</div><div class="cell t">u32</div><div class="cell d">128</div><div class="cell dsc">Docs per compressed block. Range 16–4096. Larger = better ratio, higher fetch cost.</div><div class="group" id="fts">[fts]</div><div class="cell k">default_analyzer</div><div class="cell t">enum</div><div class="cell d">"standard"</div><div class="cell dsc">"standard" · "whitespace" · "simple" · "english". Override per-field in the mapping.</div><div class="group" id="vector">[vector]</div><div class="cell k">default_metric</div><div class="cell t">enum</div><div class="cell d">"cosine"</div><div class="cell dsc">"cosine" · "dot_product" · "euclidean". Cosine for text embeddings is the usual choice.</div><div class="cell k">hnsw_m</div><div class="cell t">u32</div><div class="cell d">16</div><div class="cell dsc">Accepted and validated; the built-in HNSW graph currently builds with fixed M=16 — this key is not yet wired to the build.</div><div class="cell k">hnsw_ef_construction</div><div class="cell t">u32</div><div class="cell d">200</div><div class="cell dsc">Accepted; must be ≥ hnsw_m. The graph currently builds with fixed ef_construction=200 — this key is not yet wired to the build.</div><div class="cell k">hnsw_ef_search</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Accepted but not read by the serving path — the ANN beam width comes from the request's num_candidates (floored at 800).</div><div class="cell k">default_quantization</div><div class="cell t">enum</div><div class="cell d">"none"</div><div class="cell dsc">"none" (the default) or "scalar8" = 4× RAM saving, 1–2% recall loss. "scalar4" and "binary" have no quantizer behind them and are refused at startup rather than silently stored at full precision.</div><div class="cell k">max_dimensions</div><div class="cell t">u32</div><div class="cell d">16384</div><div class="cell dsc">Upper bound on vector dimensionality. 4× the Elasticsearch limit of 4096.</div><div class="group" id="logs">[logs]</div><div class="cell k">retention_days</div><div class="cell t">u32</div><div class="cell d">90</div><div class="cell dsc">Auto-delete log docs older than N days. 0 disables.</div><div class="cell k">time_partition</div><div class="cell t">enum</div><div class="cell d">"1h"</div><div class="cell dsc">"1m" · "5m" · "15m" · "1h" · "6h" · "1d". Time-slice granularity for retention pruning.</div><div class="group" id="embedding">[embedding]</div><div class="cell k">default_endpoint</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">OpenAI-compatible embeddings URL. Empty disables auto-embedding on ingest. Example: "https://api.openai.com/v1/embeddings".</div><div class="cell k">default_model</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Model name passed to the endpoint. Example: "text-embedding-3-small" or "nomic-embed-text".</div><div class="cell k">batch_size</div><div class="cell t">u32</div><div class="cell d">64</div><div class="cell dsc">Docs per embedding API call. Range 1–2048. Bigger batches amortise round-trip cost.</div><div class="cell k">timeout_ms</div><div class="cell t">u32</div><div class="cell d">5000</div><div class="cell dsc">HTTP timeout for embedding calls (ms). Ingest fails with a timeout error if exceeded.</div><div class="group" id="limits">[limits]</div><div class="cell k">max_query_memory_mb</div><div class="cell t">u32</div><div class="cell d">512</div><div class="cell dsc">Per-query memory cap (MiB). Queries that exceed it are cancelled.</div><div class="cell k">max_concurrent_searches</div><div class="cell t">u32</div><div class="cell d">64</div><div class="cell dsc">Global in-flight search ceiling. Extras are queued.</div><div class="cell k">max_fields_per_index</div><div class="cell t">u32</div><div class="cell d">500</div><div class="cell dsc">Field-explosion protection. ES default is 1000; 500 is intentionally stricter.</div><div class="group" id="indexing">[indexing]</div><div class="cell k">turbo_batch_size</div><div class="cell t">u32</div><div class="cell d">1000</div><div class="cell dsc">Docs per batch in turbo mode. Range 500–5000. Larger = higher throughput, slightly higher latency.</div><div class="cell k">turbo_parallel</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Parallel tokenisation on Rayon threads. Disable only for debugging.</div><div class="cell k">turbo_fast_analyzer</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Skip stemming and stop-word removal in turbo mode. Trades recall for speed.</div><div class="group" id="cluster">[cluster]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Enable multi-node cluster mode. When true, the Raft state machine and cluster transport are started on port.</div><div class="cell k">port</div><div class="cell t">u16</div><div class="cell d">9300</div><div class="cell dsc">TCP port for intra-cluster Raft and search messages. Must be reachable from every peer.</div><div class="cell k">peers</div><div class="cell t">array</div><div class="cell d">[]</div><div class="cell dsc">Peer list in "node_id=host:port" format. The local node identifies itself from the entry matching bind_address:port. Example: ["a=10.0.0.1:9300","b=10.0.0.2:9300","c=10.0.0.3:9300"].</div><div class="cell k">tick_ms</div><div class="cell t">u64</div><div class="cell d">50</div><div class="cell dsc">Raft tick interval (ms). Lower = faster leader election at the cost of CPU.</div><div class="cell k">auth_secret</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Cluster-wide shared secret authenticating every control frame on port (HMAC-SHA256 over a per-connection challenge). Mandatory when enabled = true — with cluster mode on and no secret here or in XERJ_CLUSTER_AUTH_SECRET the node refuses to start. Same value on every node; minimum 16 chars; generate with `openssl rand -hex 32`. Authenticates, does not encrypt.</div></div>+ <div class="cfg"><div class="head">KEY</div><div class="head">TYPE</div><div class="head">DEFAULT</div><div class="head">DESCRIPTION</div><div class="group" id="server">[server]</div><div class="cell k">rest_port</div><div class="cell t">u16</div><div class="cell d">8080</div><div class="cell dsc">Native REST API listener port. All native endpoints (/v1/*) live here.</div><div class="cell k">grpc_port</div><div class="cell t">u16</div><div class="cell d">8081</div><div class="cell dsc">Reserved for a future gRPC API. Not wired in v0.1 — leave at default.</div><div class="cell k">es_compat_port</div><div class="cell t">u16</div><div class="cell d">9200</div><div class="cell dsc">Elasticsearch-compatible wire port. Point Kibana, Logstash, or the ES client here. Set to 0 to disable.</div><div class="cell k">bind_address</div><div class="cell t">string</div><div class="cell d">"0.0.0.0"</div><div class="cell dsc">Interface to bind every listener to. Use "127.0.0.1" for dev or a private address in production.</div><div class="cell k">data_dir</div><div class="cell t">path</div><div class="cell d">"./data"</div><div class="cell dsc">Root for indices, WAL files, and segments. Needs fast I/O and enough free space.</div><div class="group" id="auth">[auth]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Require an API key on every request. Set to false only on a trusted network.</div><div class="cell k">admin_api_key</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Static admin key. Left empty, a 256-bit key is generated on first run and written to <data_dir>/admin.key.</div><div class="group" id="tls">[tls]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Terminate TLS at the server. Requires cert_path + key_path. If you terminate at a proxy, leave false.</div><div class="cell k">cert_path</div><div class="cell t">path</div><div class="cell d">""</div><div class="cell dsc">PEM X.509 certificate. Use a CA-signed cert in production.</div><div class="cell k">key_path</div><div class="cell t">path</div><div class="cell d">""</div><div class="cell dsc">PEM private key. Permissions should be 0600.</div><div class="group" id="storage">[storage]</div><div class="cell k">wal_sync</div><div class="cell t">enum</div><div class="cell d">"batched"</div><div class="cell dsc">"sync" · "batched" · "async". Durability vs throughput. Batched is the recommended default.</div><div class="cell k">wal_batch_ms</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Fsync cadence when wal_sync="batched" (ms). Range 1–10000. Lower = smaller loss window.</div><div class="cell k">wal_max_size_mb</div><div class="cell t">u32</div><div class="cell d">1024</div><div class="cell dsc">WAL rollover threshold (MiB). Larger means fewer rollovers, longer crash recovery.</div><div class="cell k">flush_size_mb</div><div class="cell t">u32</div><div class="cell d">512</div><div class="cell dsc">Memtable buffer size that triggers a segment flush (MiB).</div><div class="cell k">flush_interval_secs</div><div class="cell t">u32</div><div class="cell d">30</div><div class="cell dsc">Maximum wall-clock interval between flushes even if the buffer is not full.</div><div class="group" id="merge">[merge]</div><div class="cell k">strategy</div><div class="cell t">enum</div><div class="cell d">"size_tiered"</div><div class="cell dsc">Only "size_tiered" is implemented; "log_structured" is refused at startup rather than silently running the other policy.</div><div class="cell k">min_segments</div><div class="cell t">u32</div><div class="cell d">10</div><div class="cell dsc">Accepted and validated (must be ≥ 2) but <strong>not wired</strong>: the merge trigger is per-tier and comes from min_merge_count. Setting it away from the default logs a warning at startup.</div><div class="cell k">max_segment_mb</div><div class="cell t">u32</div><div class="cell d">8192</div><div class="cell dsc">Upper bound on a mergeable segment (MiB). Segments at or above this size are never merged again.</div><div class="cell k">io_rate_mb_per_sec</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Accepted but <strong>not wired</strong>: merge I/O is not throttled in this build — the rate limiter that honours it sits in an unused storage-crate merge executor. Setting it away from the default logs a warning at startup.</div><div class="cell k">max_concurrent</div><div class="cell t">u8</div><div class="cell d">1</div><div class="cell dsc">Accepted but <strong>not wired</strong>: merge parallelism comes from the XERJ_MERGE_PARALLELISM environment variable, which also defaults to 1. Setting it away from the default logs a warning at startup.</div><div class="group" id="compression">[compression]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Block-level compression. Disabling increases disk usage and lowers read CPU.</div><div class="cell k">level</div><div class="cell t">enum</div><div class="cell d">"balanced"</div><div class="cell dsc">"fast" (LZ4), "balanced" (Zstd L3, default), "best" (Zstd L19, cold storage).</div><div class="cell k">block_size_docs</div><div class="cell t">u32</div><div class="cell d">128</div><div class="cell dsc">Docs per compressed block. Range 16–4096. Larger = better ratio, higher fetch cost.</div><div class="group" id="fts">[fts]</div><div class="cell k">default_analyzer</div><div class="cell t">enum</div><div class="cell d">"standard"</div><div class="cell dsc">"standard" · "whitespace" · "simple" · "english". Override per-field in the mapping.</div><div class="group" id="vector">[vector]</div><div class="cell k">default_metric</div><div class="cell t">enum</div><div class="cell d">"cosine"</div><div class="cell dsc">"cosine" · "dot_product" · "euclidean". Cosine for text embeddings is the usual choice.</div><div class="cell k">hnsw_m</div><div class="cell t">u32</div><div class="cell d">16</div><div class="cell dsc">Accepted and validated; the built-in HNSW graph currently builds with fixed M=16 — this key is not yet wired to the build.</div><div class="cell k">hnsw_ef_construction</div><div class="cell t">u32</div><div class="cell d">200</div><div class="cell dsc">Accepted; must be ≥ hnsw_m. The graph currently builds with fixed ef_construction=200 — this key is not yet wired to the build.</div><div class="cell k">hnsw_ef_search</div><div class="cell t">u32</div><div class="cell d">100</div><div class="cell dsc">Accepted but not read by the serving path — the ANN beam width comes from the request's num_candidates (floored at 800).</div><div class="cell k">default_quantization</div><div class="cell t">enum</div><div class="cell d">"none"</div><div class="cell dsc">"none" (the default) or "scalar8" = 4× RAM saving, 1–2% recall loss. "binary" has no quantizer behind it and is refused at startup rather than silently stored at full precision; "scalar4" is not a value this key accepts at all (the 4-bit quantizer in the vector crate is unreachable from config or mapping).</div><div class="cell k">max_dimensions</div><div class="cell t">u32</div><div class="cell d">16384</div><div class="cell dsc">Upper bound on vector dimensionality. 4× the Elasticsearch limit of 4096.</div><div class="group" id="logs">[logs]</div><div class="cell k">retention_days</div><div class="cell t">u32</div><div class="cell d">90</div><div class="cell dsc">Auto-delete log docs older than N days. 0 disables.</div><div class="cell k">time_partition</div><div class="cell t">enum</div><div class="cell d">"1h"</div><div class="cell dsc">"1m" · "5m" · "15m" · "1h" · "6h" · "1d". Time-slice granularity for retention pruning.</div><div class="group" id="embedding">[embedding]</div><div class="cell k">default_endpoint</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">OpenAI-compatible embeddings URL. Empty disables auto-embedding on ingest. Example: "https://api.openai.com/v1/embeddings".</div><div class="cell k">default_model</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Model name passed to the endpoint. Example: "text-embedding-3-small" or "nomic-embed-text".</div><div class="cell k">batch_size</div><div class="cell t">u32</div><div class="cell d">64</div><div class="cell dsc">Docs per embedding API call. Range 1–2048. Bigger batches amortise round-trip cost.</div><div class="cell k">timeout_ms</div><div class="cell t">u32</div><div class="cell d">5000</div><div class="cell dsc">HTTP timeout for embedding calls (ms). Ingest fails with a timeout error if exceeded.</div><div class="group" id="limits">[limits]</div><div class="cell k">max_query_memory_mb</div><div class="cell t">u32</div><div class="cell d">512</div><div class="cell dsc">Per-query memory cap (MiB). Queries that exceed it are cancelled.</div><div class="cell k">max_concurrent_searches</div><div class="cell t">u32</div><div class="cell d">64</div><div class="cell dsc">Global in-flight search ceiling. Extras are queued.</div><div class="cell k">max_fields_per_index</div><div class="cell t">u32</div><div class="cell d">500</div><div class="cell dsc">Field-explosion protection. ES default is 1000; 500 is intentionally stricter.</div><div class="group" id="indexing">[indexing]</div><div class="cell k">turbo_batch_size</div><div class="cell t">u32</div><div class="cell d">1000</div><div class="cell dsc">Docs per batch in turbo mode. Range 500–5000. Larger = higher throughput, slightly higher latency.</div><div class="cell k">turbo_parallel</div><div class="cell t">bool</div><div class="cell d">true</div><div class="cell dsc">Parallel tokenisation on Rayon threads. Disable only for debugging.</div><div class="cell k">turbo_fast_analyzer</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Skip stemming and stop-word removal in turbo mode. Trades recall for speed.</div><div class="group" id="cluster">[cluster]</div><div class="cell k">enabled</div><div class="cell t">bool</div><div class="cell d">false</div><div class="cell dsc">Enable multi-node cluster mode. When true, the Raft state machine and cluster transport are started on port.</div><div class="cell k">port</div><div class="cell t">u16</div><div class="cell d">9300</div><div class="cell dsc">TCP port for intra-cluster Raft and search messages. Must be reachable from every peer.</div><div class="cell k">peers</div><div class="cell t">array</div><div class="cell d">[]</div><div class="cell dsc">Peer list in "node_id=host:port" format. The local node identifies itself from the entry matching bind_address:port. Example: ["a=10.0.0.1:9300","b=10.0.0.2:9300","c=10.0.0.3:9300"].</div><div class="cell k">tick_ms</div><div class="cell t">u64</div><div class="cell d">50</div><div class="cell dsc">Raft tick interval (ms). Lower = faster leader election at the cost of CPU.</div><div class="cell k">auth_secret</div><div class="cell t">string</div><div class="cell d">""</div><div class="cell dsc">Cluster-wide shared secret authenticating every control frame on port (HMAC-SHA256 over a per-connection challenge). Mandatory when enabled = true — with cluster mode on and no secret here or in XERJ_CLUSTER_AUTH_SECRET the node refuses to start. Same value on every node; minimum 16 chars; generate with `openssl rand -hex 32`. Authenticates, does not encrypt.</div></div><h2 id="server-section">[server]</h2>@@ -134,7 +134,7 @@ rest_port = 8080 # native /v1/* APIes_compat_port = 9200 # ES wire-compatible APIgrpc_port = 8081 # reservedbind_address = "0.0.0.0" # listen on all interfaces-data_dir = "/var/lib/xerj" # absolute path is strongly recommended</pre>+data_dir = "/var/lib/xerj" # not a default ("./data") — an absolute path is strongly recommended</pre><h2 id="auth-section">[auth]</h2><p>Static API-key authentication. The first-run admin key is written to <code class="inline"><data_dir>/admin.key</code>; subsequent starts reuse it. Clients pass <code class="inline">Authorization: ApiKey <key></code> on every request.</p>@@ -148,17 +148,17 @@ admin_api_key = "" # blank → auto-generated on first run<h2 id="tls-section">[tls]</h2><p>TLS termination at the server. In Kubernetes or behind a load balancer, leave this off and terminate at the proxy instead — one place to rotate certs, one place to log handshakes.</p><pre class="code">[tls]-enabled = true-cert_path = "/etc/xerj/certs/server.crt"-key_path = "/etc/xerj/certs/server.key"</pre>+enabled = true # not a default (false) — this block switches TLS on+cert_path = "/etc/xerj/certs/server.crt" # not a default ("") — your certificate+key_path = "/etc/xerj/certs/server.key" # not a default ("") — your private key</pre><h2 id="storage-section">[storage]</h2><p>The WAL and flush tuning. <code class="inline">wal_sync</code> is the durability knob everyone looks for — pick <code class="inline">"sync"</code> for financial/compliance workloads, <code class="inline">"batched"</code> for everything else, and <code class="inline">"async"</code> only in benchmarks.</p><pre class="code">[storage]wal_sync = "batched"wal_batch_ms = 100 # fsync every 100 ms-wal_max_size_mb = 512 # roll WAL every 512 MiB-flush_size_mb = 256 # flush memtable at 256 MiB+wal_max_size_mb = 1024 # roll WAL every 1 GiB+flush_size_mb = 512 # flush memtable at 512 MiBflush_interval_secs = 30</pre><h2 id="merge-section">[merge]</h2>@@ -192,21 +192,21 @@ default_metric = "cosine"hnsw_m = 16 # accepted for compat; kNN serving is exacthnsw_ef_construction = 200 # accepted for compat; no effect on resultshnsw_ef_search = 100 # accepted for compat; no effect on results-default_quantization = "scalar8" # 4× RAM saving+default_quantization = "none" # "scalar8" = 4× RAM saving, 1–2% recall lossmax_dimensions = 16384</pre><h2 id="logs-section">[logs]</h2><p>Time-series retention. Log indices are sliced into partitions of <code class="inline">time_partition</code> width so retention prunes are O(partitions), not O(documents).</p><pre class="code">[logs]-retention_days = 30 # keep 30 days+retention_days = 30 # not a default (90) — keep 30 daystime_partition = "1h" # 1-hour partitions</pre><h2 id="embedding-section">[embedding]</h2><p>Delegates vector generation to an OpenAI-compatible endpoint. Leave <code class="inline">default_endpoint</code> empty if clients provide vectors themselves. Token limits are model-specific; the chunker in the <code class="inline">ai</code> crate splits long documents to fit the model's window.</p><pre class="code">[embedding]# OpenAI:-default_endpoint = "https://api.openai.com/v1/embeddings"-default_model = "text-embedding-3-small"+default_endpoint = "https://api.openai.com/v1/embeddings" # not a default ("" disables auto-embedding)+default_model = "text-embedding-3-small" # not a default ("")batch_size = 64timeout_ms = 5000@@ -224,16 +224,16 @@ max_fields_per_index = 500</pre><h2 id="indexing-section">[indexing]</h2><p>Turbo mode knobs. Turbo is opt-in per-request via <code class="inline">POST /v1/indices/:name/turbo-ingest</code> or the <code class="inline">X-Turbo: true</code> header on <code class="inline">_bulk</code>; these settings only apply when turbo is active.</p><pre class="code">[indexing]-turbo_batch_size = 2000+turbo_batch_size = 2000 # not a default (1000)turbo_parallel = trueturbo_fast_analyzer = false # true only if recall doesn't matter</pre><h2 id="cluster-section">[cluster]</h2><p>Multi-node mode. Default is off — single-node doesn't need a consensus layer. When enabled, the embedded Raft implementation replicates <strong>metadata only</strong> (schemas, shard assignments, node roster). See <a href="/docs/clustering.html">Clustering</a> for the full story.</p><pre class="code">[cluster]-enabled = true+enabled = true # not a default (false) — this block switches cluster mode onport = 9300 # intra-cluster gRPC + Raft-peers = [+peers = [ # not a default ([]) — your node roster"a=10.0.0.11:9300","b=10.0.0.12:9300","c=10.0.0.13:9300",diff --git a/landing/docs/storage.html b/landing/docs/storage.htmlindex 9b68f654d..92693a11d 100644--- a/landing/docs/storage.html+++ b/landing/docs/storage.html@@ -142,7 +142,7 @@└── snapshots/</pre><h2>WAL</h2>- <p>Append-only per index. Generation-rotated at <code class="inline">wal_max_size_mb</code> (default <strong>512 MiB</strong>). Retained until the flush checkpoint passes the tail generation, then the old file is released. Fsync policy is controlled by <code class="inline">[storage] wal_sync</code>:</p>+ <p>Append-only per index. Generation-rotated at <code class="inline">wal_max_size_mb</code> (default <strong>1024 MiB</strong>). Retained until the flush checkpoint passes the tail generation, then the old file is released. Fsync policy is controlled by <code class="inline">[storage] wal_sync</code>:</p><ul><li><strong>sync</strong> — fsync <em>before</em> acknowledging each write (one fsync per <code class="inline">_bulk</code> request = group commit). <strong>Power-loss durable</strong>, matching Elasticsearch's default <code class="inline">index.translog.durability: request</code>. Lowest throughput; financial or compliance workloads.</li><li><strong>batched</strong> (default) — writes reach the kernel immediately, so an XERJ <strong>process crash loses nothing</strong>; a background loop fsyncs every <code class="inline">wal_batch_ms</code> (default 100 ms), so a <strong>power loss or kernel panic</strong> can lose at most the last ~100 ms of acknowledged writes. Deliberately <em>below</em> Elasticsearch's request-fsync default in exchange for throughput — set <code class="inline">wal_sync = "sync"</code> when you need power-loss durability.</li>diff --git a/landing/docs/vectors.html b/landing/docs/vectors.htmlindex dd3e6b22e..ccdc098c2 100644--- a/landing/docs/vectors.html+++ b/landing/docs/vectors.html@@ -150,13 +150,13 @@</div><h2 id="quantization">Quantization</h2>- <p>XERJ supports four quantization modes. <code class="inline">scalar8</code> (SQ8) is the default and gives ~4× memory reduction with almost no recall loss on typical embedding spaces.</p>+ <p><strong>Quantization is off by default</strong> — <code class="inline">[vector] default_quantization = "none"</code>, full-precision f32. Opt in per field with <code class="inline">index_options.type: int8_hnsw</code> (or <code class="inline">int8_flat</code>) on the mapping, or index-wide by setting the key.</p><ul>- <li><strong>none</strong> — full-precision f32. Use when recall matters more than RAM.</li>- <li><strong>scalar8</strong> — 8-bit per dimension. Default. ~4× smaller. Recall impact typically under 1%.</li>- <li><strong>scalar4</strong> — 4-bit per dimension. ~8× smaller. Noticeable recall hit on fine-grained spaces.</li>- <li><strong>binary</strong> — 1-bit per dimension with Hamming distance. ~32× smaller. Use only if you know the embedding space tolerates it.</li>+ <li><strong>none</strong> — full-precision f32. <em>The default.</em> Use when recall matters more than RAM.</li>+ <li><strong>scalar8</strong> — 8-bit per dimension. ~4× smaller vectors, 1–2% recall loss. The one quantizer the serving path reads.</li>+ <li><strong>binary</strong> — 1-bit per dimension. Not implemented: the server <strong>refuses to start</strong> on <code class="inline">default_quantization = "binary"</code> rather than silently storing full precision while claiming a 32× saving.</li></ul>+ <p>A 4-bit quantizer exists in the vector crate but no config or mapping value reaches it, so <code class="inline">scalar4</code> is not a mode you can select in this build.</p><h2 id="knn-query">KNN query</h2><pre class="code">{