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.

docs(changelog): say plainly that `_rank_eval` still publishes a metric_score

xerj-org12e2ede9e111
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cf247991..be19a65eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,7 +57,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`_msearch/template` render it as a per-response 400 envelope with `type` and
`root_cause`, leaving the sibling sub-requests in the batch untouched; and
`_rank_eval` records the refused request under `failures` instead of dropping
- it from `details` *and* `failures` while still publishing a `metric_score`.
+ it from `details` *and* `failures`. It still publishes a `metric_score`, and
+ that number is still the mean over the requests that actually ran — which is
+ ES's behaviour too — but the batch no longer shrinks silently underneath it:
+ a two-request batch in which one is refused now answers `details: {good}`,
+ `failures: {bad}`, `metric_score: 1.0` (measured), so a relevance gate reading
+ a clean score can see what did not contribute to it.
A multi-index `_count` follows ES's broadcast rule rather than failing
outright: the failure status is returned only when **no** index answered
diff --git a/engine/crates/xerj-api/tests/index_false_is_honoured.rs b/engine/crates/xerj-api/tests/index_false_is_honoured.rs
index 569ca1217..32e59f6fd 100644
--- a/engine/crates/xerj-api/tests/index_false_is_honoured.rs
+++ b/engine/crates/xerj-api/tests/index_false_is_honoured.rs
@@ -1004,6 +1004,18 @@ async fn rank_eval_records_a_refused_request_in_failures() {
Some("query_shard_exception"),
"{body}"
);
+
+ // The score is still published, and it is still the mean over the requests
+ // that ran — `bad` contributes nothing rather than counting as a zero, and
+ // ES computes it the same way. This is asserted because the CHANGELOG
+ // states the number: a reader has to be able to check the claim, and the
+ // point of the fix is that the batch no longer shrinks *silently*, not that
+ // the score changed.
+ assert_eq!(
+ body.get("metric_score").and_then(Value::as_f64),
+ Some(1.0),
+ "the surviving request's precision is the published score: {body}"
+ );
}
/// `query_string`'s `fields` array is read, and a named unsearchable field in