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.

autoindex: factor the label stub's canned-vote tuple into type defs (PR #1082 CI)

xerj-orgacd6c3b2989e
diff --git a/engine/crates/xerj-autoindex/src/label.rs b/engine/crates/xerj-autoindex/src/label.rs
index 441eed463..3a9d83387 100644
--- a/engine/crates/xerj-autoindex/src/label.rs
+++ b/engine/crates/xerj-autoindex/src/label.rs
@@ -462,12 +462,17 @@ mod tests {
assert_eq!(q, "Is wire transfer (ticket 3, )");
}
+ /// (label-to-return, p, abstain) — the canned vote for one positive label.
+ type StubAnswer = (String, f64, bool);
+ /// positive label → its canned vote.
+ type StubAnswers = std::collections::HashMap<String, StubAnswer>;
+
/// A loopback decide endpoint answering canned votes, so the Labeler is
/// exercised over real HTTP without a node.
struct DecideStub {
url: String,
- /// Answers by positive label: (label-to-return, p, abstain).
- answers: Arc<Mutex<std::collections::HashMap<String, (String, f64, bool)>>>,
+ /// Answers by positive label.
+ answers: Arc<Mutex<StubAnswers>>,
stop: Arc<Mutex<bool>>,
join: Option<std::thread::JoinHandle<()>>,
}
@@ -524,10 +529,7 @@ mod tests {
}
}
- fn serve(
- mut stream: TcpStream,
- answers: &Mutex<std::collections::HashMap<String, (String, f64, bool)>>,
- ) {
+ fn serve(mut stream: TcpStream, answers: &Mutex<StubAnswers>) {
let mut reader = BufReader::new(stream.try_clone().unwrap());
let mut request_line = String::new();
if reader.read_line(&mut request_line).unwrap() == 0 {