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.

feat(api): #310 emission site 1 — re-narrow the top-level _source after the pierce (WIP)

xerj-orgf980f59d639a
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index 27f3bed72..dd54eeac5 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -11971,6 +11971,22 @@ async fn search_impl(
!name.starts_with(xerj_query::executor::PASSAGE_METADATA_PREFIX)
});
}
+ // #310 emission site 1: this request pierced the default
+ // `_source` projection so the `fields` builder below could
+ // resolve an embedding companion the caller explicitly named.
+ // The pierce ends HERE — `fields` reads `h.source`, which is
+ // untouched, while the wire `_source` carries exactly what the
+ // #309 default would have carried. Miss this and #309's headline
+ // guarantee turns into a full-vector response for anyone who
+ // named a companion in `fields`.
+ if pierce_default_source {
+ if let (Some(companions), Some(obj)) = (
+ companions_by_index.get(idx_name.as_str()),
+ s.as_object_mut(),
+ ) {
+ obj.retain(|name, _| !companions.contains(name));
+ }
+ }
// Non-synthetic mode: strip the internal copy-to
// tracking marker; keep the copied values in the source
// since stored-source clients expect them.