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): omit an unresolvable docvalue_field instead of emitting [] (#310)

xerj-org98f278bca871
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index dd54eeac5..21692c16e 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -34424,8 +34424,18 @@ pub(crate) fn build_docvalue_fields(
} else {
arr
};
+ // A field that resolves to NO values is omitted, never emitted as a bare
+ // `[]` (#310): `{"body_vector": []}` is a positive claim that the doc has
+ // no values for that field. ES omits an unresolvable `docvalue_fields`
+ // entry entirely (mirrors the `fields` builder's `None => continue`).
+ if formatted.is_empty() {
+ continue;
+ }
map.insert(field_name.to_string(), Value::Array(formatted));
}
+ if map.is_empty() {
+ return None;
+ }
Some(map)
}