Skip to content

armgit / xerj

Public Imported from GitHub
0

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.

test(perf): record the doc-values denominator — the lever is a range, not 37%

xerj-org14b664e5a8df
diff --git a/demo/playbooks/rc12/EVIDENCE-doc-values-on-text.md b/demo/playbooks/rc12/EVIDENCE-doc-values-on-text.md
index 24babbaf7..18c8db050 100644
--- a/demo/playbooks/rc12/EVIDENCE-doc-values-on-text.md
+++ b/demo/playbooks/rc12/EVIDENCE-doc-values-on-text.md
@@ -186,3 +186,49 @@ is the single most important implementation detail in the lever.
or the `size:0` count shortcut ever bind to a `text` field. Those paths are real and
fast; if any of them can target `text`, they need a fallback before the column goes
away.
+
+---
+
+## The denominator — why 37.1% is NOT the headline
+
+An independent adversarial re-measurement (parsing the `DV01` envelope of **all
+7,113 `.dv` sidecars** across a 4,245 MiB live data dir) confirmed the *numerator*
+and demolished the *denominator*:
+
+| | measured |
+|---|---:|
+| `.dv` removed by skipping text/`semantic_text` | **90–99%** of `.dv` payload |
+| `.dv` as a share of on-disk bytes (4,245 MiB, 7,113 sidecars) | **6.97%** |
+| per-index `.dv` share, range | **1.71% – 11.88%** |
+| `.seg` (stored `_source`) as a share | **64.21%** |
+| `.dv` share on `rc12bench` 500k (this file's corpus) | 37.1% |
+| `.dv` share on a synthetic pure-text index | 39.7% |
+
+Both sets of numbers are correct. They differ because **the lever's worth is set by
+how large `_source` is relative to the indexed text.** On autoindex-generated code
+corpora, where `_source` holds whole source files, `.seg` dominates at 64% and `.dv`
+is ~7% — on `xc-dataplane-cilium-vendor` it is **1.71%**, making the whole lever
+worth about 1.6% there. On short-document corpora like this file's benchmark, the
+same lever is worth ~37%.
+
+**The defensible public statement is therefore a range, never a single number:**
+*"removes 90–99% of the doc-values sidecar; that sidecar is 2–40% of index size
+depending on corpus."* Quoting 37% as the headline would be a cross-corpus splice —
+per-type split measured on one corpus, denominator imported from another.
+
+### A correction to the correction above
+
+The earlier note in this file claimed that implementing the lever "fails the
+conformance gate" on `terms_text_docvalues.yml`. **That was re-checked and refuted.**
+All three cases survive a columnless text field: case 2 already runs with no column
+today (arrays suppress the column at `index.rs:17407-17409`), and cases 1 and 3 bail
+to the brute path and produce byte-identical buckets. The gate stays green.
+
+The real constraint on this lever is the denominator, not conformance. It should
+still be implemented as "default off, honour an explicit `doc_values: true`", because
+that matches ES and is the right behaviour — but it should be **scheduled on the
+strength of `.seg`, not `.dv`**, on any corpus where `_source` dominates.
+
+Also noted: `is_aggregatable()` is *not* the only reader of `options.doc_values` —
+`crates/xerj-console-api/src/data_sources.rs:199` reads it too and reports it in the
+console field listing.
diff --git a/demo/playbooks/rc12/results-baseline-nocache.json b/demo/playbooks/rc12/results-baseline-nocache.json
index a19c97eb3..761c0c632 100644
--- a/demo/playbooks/rc12/results-baseline-nocache.json
+++ b/demo/playbooks/rc12/results-baseline-nocache.json
@@ -20,5 +20,157 @@
"xerj_master_key": 64,
"sidx": 32,
"lock": 7
+ },
+ "queries": {
+ "term_keyword_low_card": {
+ "p50_ms": 0.609,
+ "p99_ms": 0.841,
+ "took_ms": 0,
+ "hits": 10000
+ },
+ "term_keyword_high_card": {
+ "p50_ms": 1.476,
+ "p99_ms": 1.682,
+ "took_ms": 1,
+ "hits": 1
+ },
+ "range_date_narrow": {
+ "p50_ms": 0.526,
+ "p99_ms": 0.811,
+ "took_ms": 0,
+ "hits": 50
+ },
+ "range_long_wide": {
+ "p50_ms": 0.432,
+ "p99_ms": 0.562,
+ "took_ms": 0,
+ "hits": 10000
+ },
+ "match_text_common": {
+ "p50_ms": 166.292,
+ "p99_ms": 169.296,
+ "took_ms": 167,
+ "hits": 10000
+ },
+ "match_text_multi": {
+ "p50_ms": 493.901,
+ "p99_ms": 513.753,
+ "took_ms": 527,
+ "hits": 10000
+ },
+ "match_phrase": {
+ "p50_ms": 495.584,
+ "p99_ms": 518.703,
+ "took_ms": 504,
+ "hits": 10000
+ },
+ "bool_must_filter": {
+ "p50_ms": 2846.619,
+ "p99_ms": 2947.365,
+ "took_ms": 2758,
+ "hits": 10000
+ },
+ "deep_page": {
+ "p50_ms": 56.485,
+ "p99_ms": 63.373,
+ "took_ms": 55,
+ "hits": 10000
+ },
+ "large_page": {
+ "p50_ms": 168.962,
+ "p99_ms": 221.147,
+ "took_ms": 166,
+ "hits": 10000
+ },
+ "sort_by_numeric": {
+ "p50_ms": 2.392,
+ "p99_ms": 2.601,
+ "took_ms": 1,
+ "hits": 10000
+ },
+ "agg_terms_low_card": {
+ "p50_ms": 0.415,
+ "p99_ms": 0.706,
+ "took_ms": 0,
+ "hits": 10000
+ },
+ "agg_terms_high_card": {
+ "p50_ms": 2.748,
+ "p99_ms": 2.989,
+ "took_ms": 2,
+ "hits": 10000
+ },
+ "agg_stats_numeric": {
+ "p50_ms": 0.205,
+ "p99_ms": 0.274,
+ "took_ms": 0,
+ "hits": 10000
+ },
+ "agg_date_histogram": {
+ "p50_ms": 16.903,
+ "p99_ms": 17.25,
+ "took_ms": 16,
+ "hits": 10000
+ },
+ "agg_histogram_numeric": {
+ "p50_ms": 10.073,
+ "p99_ms": 10.283,
+ "took_ms": 9,
+ "hits": 10000
+ },
+ "agg_nested_terms_stats": {
+ "p50_ms": 3.33,
+ "p99_ms": 3.449,
+ "took_ms": 3,
+ "hits": 10000
+ },
+ "boosting": {
+ "p50_ms": 2708.917,
+ "p99_ms": 2745.635,
+ "took_ms": 2696,
+ "hits": 10000
+ },
+ "function_score": {
+ "p50_ms": 4608.299,
+ "p99_ms": 4655.712,
+ "took_ms": 4623,
+ "hits": 10000
+ },
+ "match_phrase_prefix": {
+ "p50_ms": 4369.236,
+ "p99_ms": 4651.39,
+ "took_ms": 4406,
+ "hits": 10000
+ },
+ "fuzzy_text": {
+ "p50_ms": 306.163,
+ "p99_ms": 313.483,
+ "took_ms": 309,
+ "hits": 10000
+ },
+ "wildcard_text": {
+ "p50_ms": 180.519,
+ "p99_ms": 184.666,
+ "took_ms": 177,
+ "hits": 10000
+ },
+ "prefix_text": {
+ "p50_ms": 170.913,
+ "p99_ms": 180.043,
+ "took_ms": 169,
+ "hits": 10000
+ },
+ "agg_terms_on_text": {
+ "p50_ms": 3414.46,
+ "p99_ms": 3481.915,
+ "took_ms": 3357,
+ "hits": 10000
+ },
+ "sort_on_text": {
+ "p50_ms": 1535.11,
+ "p99_ms": 1558.18,
+ "took_ms": 1530,
+ "hits": 10000
+ }
}
}
\ No newline at end of file