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(es-compat): read alias filters from the names as written, not the expanded list

xerj-orgd518a196ff58
diff --git a/engine/crates/xerj-api/src/es_compat.rs b/engine/crates/xerj-api/src/es_compat.rs
index d25a97e48..e60ac8b34 100644
--- a/engine/crates/xerj-api/src/es_compat.rs
+++ b/engine/crates/xerj-api/src/es_compat.rs
@@ -9180,15 +9180,23 @@ async fn search_impl(
// filter. The combined filter is also handed to run_aggs via the
// background corpus (covered by the query's filter path already).
{
+ // Built from the names as WRITTEN, not from `index_names`. Expanding
+ // an alias to its concrete members (#433) removes the alias name from
+ // that list, and this lookup matches on the alias name — so reading it
+ // from the expanded list silently dropped every filtered alias's
+ // filter. `global_with_aliases.yml` caught exactly that.
let mut alias_filters: Vec<Value> = Vec::new();
- for name in &index_names {
+ for name in &resolved_names_owned {
for entry in state.engine.aliases.iter() {
if entry.key() != name {
continue;
}
for backing in entry.value().iter() {
if let Some(meta) = state.engine.index_alias_metadata.get(backing) {
- if let Some(filter) = meta.get(*name).and_then(|v| v.get("filter")).cloned()
+ if let Some(filter) = meta
+ .get(name.as_str())
+ .and_then(|v| v.get("filter"))
+ .cloned()
{
alias_filters.push(filter);
}