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
feat(dx): say how to scope a query when a corpus mixes code and prose
buger866e914d0fe5
diff --git a/engine/crates/xerj-autoindex/src/lib.rs b/engine/crates/xerj-autoindex/src/lib.rsindex 77af96a85..ba4588620 100644--- a/engine/crates/xerj-autoindex/src/lib.rs+++ b/engine/crates/xerj-autoindex/src/lib.rs@@ -4717,6 +4717,33 @@ pub fn run_index_report(cfg: IndexCfg) -> Result<(i32, Option<Value>)> {cfg.prefix);}+ // A mixed corpus needs one more thing said out loud. Code volume+ // swamps prose on shared vocabulary: in a blind run, a question about+ // documentation ("exit code 3") matched WordPress PHP on `exit` and+ // `code` and returned nothing but source, costing a wasted round trip.+ // The agent worked out the fix itself afterwards — scope the query —+ // which is exactly the sort of thing that should not have to be+ // rediscovered.+ let indexed_prose = plan+ .files+ .values()+ .any(|fa| fa.family.starts_with("txt") || fa.family == "html");+ if indexed_code && indexed_prose {+ println!(+ " this corpus mixes code and prose — code volume can swamp prose on\n\+ \x20 shared words. Scope the side you want:\n\+ \x20 …,\"query\":{{\"bool\":{{\"must\":[{{\"match\":{{\"body\":\"<text>\"}}}}],\+ \"filter\":[{{\"term\":{{\"ax_format\":\"code\"}}}}]}}}}\n\+ \x20 (values for `ax_format` in this run: {})",+ {+ let mut fams: Vec<&str> =+ plan.files.values().map(|fa| fa.family.as_str()).collect();+ fams.sort_unstable();+ fams.dedup();+ fams.join(", ")+ }+ );+ }}// Exit 3 means "completed, some input was unusable". Backend rejections// are not consulted and must not be: a rejected item aborts the run with