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.

fix(api): always read the complete _source on document-copying paths

bugereef9a2520f84
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index 7da2f1e96..697d0dbc3 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -18914,6 +18914,13 @@ pub async fn reindex(
"query": query_val,
"size": page_size,
"sort": [{ "_id": "asc" }],
+ // Reindex copies documents verbatim, so it must always read the
+ // COMPLETE `_source` — including engine-generated embedding
+ // companions. Omitting `_source` would inherit the search default,
+ // which deliberately hides those companions from ordinary API
+ // responses; inheriting it here would silently drop embeddings from
+ // every reindexed document.
+ "_source": true,
});
if let Some(ref sa) = search_after {
search_body_val["search_after"] = sa.clone();
@@ -26310,6 +26317,10 @@ async fn clone_index_to(state: &AppState, source: &str, target: &str) -> Result<
"query": { "match_all": {} },
"size": 10000,
"from": 0,
+ // Cloning copies documents verbatim: always read the COMPLETE `_source`,
+ // including engine-generated embedding companions, rather than inheriting
+ // the search default which hides them from ordinary API responses.
+ "_source": true,
}))
.map_err(|e| ApiError::new(xerj_common::XerjError::invalid_query(e.to_string())))?;
@@ -26481,7 +26492,11 @@ pub async fn execute_enrich_policy(
// enrich index, preserving doc ids.
let req = match parse_request(&json!({
"query": { "match_all": {} },
- "size": 10000
+ "size": 10000,
+ // Enrich policies materialise source documents into a lookup index, so
+ // they must read the COMPLETE `_source` rather than inheriting the
+ // search default which hides engine-generated embedding companions.
+ "_source": true,
})) {
Ok(r) => r,
Err(e) => {