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(engine): #421 item 2 — soften meta_sort_value's sort-vs-_seq_no agreement claim

xerj-org6036513dba67
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rs
index 8971f4dcf..1c8efda89 100644
--- a/engine/crates/xerj-engine/src/index.rs
+++ b/engine/crates/xerj-engine/src/index.rs
@@ -13084,8 +13084,14 @@ impl Index {
/// and `NumericComparator` compares those column values directly
/// (`lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java:47-63`).
/// xerj has no column for these fields, so it resolves them through the
- /// SAME accessors that populate the response meta-fields — a hit's
- /// `sort` value and its `_seq_no` / `_version` therefore agree.
+ /// SAME version-map accessors (`lookup_seq_no` / `lookup_version`) that
+ /// back the response meta-fields — so a hit's `sort` value equals its
+ /// `_seq_no` / `_version` whenever the lookup RESOLVES. It can only diverge
+ /// for a doc whose lookup returns `None` after it was collected (a
+ /// concurrent tombstone / version-map miss): this function then yields
+ /// `Value::Null` (so the request's `missing` policy governs the sort key),
+ /// while the response side applies its own `None` fallback — a narrow,
+ /// already-racing case that does not affect the ranking key computed here.
///
/// Returns `None` for every other field name, so the caller falls
/// through to the ordinary `_source` lookup.