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.

perf(search): cover the new cache category in the publication test

xerj-org666dd21dfe49
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rs
index 5534d4533..57fea0480 100644
--- a/engine/crates/xerj-engine/src/index.rs
+++ b/engine/crates/xerj-engine/src/index.rs
@@ -3230,7 +3230,9 @@ mod semantic_deadline_regression_tests {
idx.remove_segment_hydration_entries(&old_meta.id);
}
- let all = (1_u64 << 7) - 1;
+ // Derived, not hard-coded: a new SegmentCacheCategory must widen this
+ // mask automatically or the test silently stops covering it.
+ let all = (1_u64 << CATEGORY_COUNT) - 1;
idx.test_segment_cache_publish_ready_mask
.store(0, Ordering::Release);
idx.test_segment_cache_publish_pause_mask
@@ -3315,6 +3317,27 @@ mod semantic_deadline_regression_tests {
vec![b'{', b'}'],
);
}
+ SegmentCacheCategory::FtsReader => {
+ // Open with an empty field set: the reader is then cheap to
+ // build and holds nothing, but it exercises the same
+ // publish/evict path as a real one, which is what this test
+ // is about. `open` on a flushed segment cannot fail here.
+ let key = format!("{old_id}\u{1}");
+ let reader = FtsIndexReader::open(
+ idx.data_dir.join("segments"),
+ old_id.clone(),
+ &[] as &[&str],
+ )
+ .expect("opening a flushed segment with no fields must succeed");
+ let _ = idx.publish_current(
+ &idx.fts_reader_cache,
+ &old_id,
+ key,
+ category,
+ 1,
+ Arc::new(reader),
+ );
+ }
}));
}