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(cli): say that default search ranking is lexical (#1655)

xerj-orgd060f1c8e738
diff --git a/engine/crates/xerj-autoindex/src/def.rs b/engine/crates/xerj-autoindex/src/def.rs
index 3025d3cfa..6b48b7446 100644
--- a/engine/crates/xerj-autoindex/src/def.rs
+++ b/engine/crates/xerj-autoindex/src/def.rs
@@ -17,13 +17,13 @@ use crate::esclient::Es;
use crate::search::{
corpus_snapshot, empty_lookup_report, field_lookup_ok, hit_location, is_identifier,
mapped_property_names, numeric_property_names, parse_count_arg, passage_text,
- query_failure_message,
- weighted_query_fields,
+ query_failure_message, weighted_query_fields,
};
use serde_json::{json, Value};
const USAGE: &str = "\
xerj def — find where a symbol is defined (go-to-definition, no scripts)
+Default ranking is lexical: it matches the words you typed, and it is not a neural reading of the code.
USAGE:
xerj def [OPTIONS] \"<symbol or capability>\"
@@ -571,6 +571,14 @@ fn unique_locations(hits: Vec<Value>) -> Vec<Value> {
mod tests {
use super::*;
+ #[test]
+ fn help_says_the_default_ranking_is_lexical() {
+ assert!(
+ USAGE.contains("Default ranking is lexical") && USAGE.contains("not a neural reading"),
+ "{USAGE}"
+ );
+ }
+
#[test]
fn declaration_preview_keeps_a_later_constant_and_caps_a_huge_line() {
let sig = "pub fn open(\n path: &Path,\n mode: u32,\n) -> Result<File> {\n const MODE_MASK: u32 = 0o777;\n let _ = path;\n";
diff --git a/engine/crates/xerj-autoindex/src/search.rs b/engine/crates/xerj-autoindex/src/search.rs
index 631c563e9..954b14d6e 100644
--- a/engine/crates/xerj-autoindex/src/search.rs
+++ b/engine/crates/xerj-autoindex/src/search.rs
@@ -16,6 +16,7 @@ use xerj_common::xccode::demote_catalog_noise;
const USAGE: &str = "\
xerj search — retrieve code from a running XERJ node (reference coding, no scripts)
+Default ranking is lexical: it matches the words you typed, and it is not a neural reading of the code.
USAGE:
xerj search [OPTIONS] \"<what you need, in plain words>\"
@@ -963,6 +964,14 @@ mod tests {
use super::*;
use xerj_common::code_query::normalize_code_search_query;
+ #[test]
+ fn help_says_the_default_ranking_is_lexical() {
+ assert!(
+ USAGE.contains("Default ranking is lexical") && USAGE.contains("not a neural reading"),
+ "{USAGE}"
+ );
+ }
+
/// HTTP 400 `For input string` is a numeric field, not a wrong prefix.
/// A missing index still gets the prefix sentence.
#[test]
diff --git a/engine/crates/xerj-autoindex/src/xc.rs b/engine/crates/xerj-autoindex/src/xc.rs
index 0041f5592..f01559e7e 100644
--- a/engine/crates/xerj-autoindex/src/xc.rs
+++ b/engine/crates/xerj-autoindex/src/xc.rs
@@ -119,6 +119,10 @@ const CODE_USAGE: &str =
retrieval over a reference corpus (see `xerj corpus list`):
-k N passages to return (default 5)
--mode MODE bm25 (default, measured 12/12 top-3), semantic, or hybrid
+ Default ranking is lexical: it matches the words you typed,
+ and it is not a neural reading of the code. --mode semantic
+ and --mode hybrid embed with lexical feature hashing unless
+ the node was started with --embed-mode neural.
--hybrid shorthand for --mode hybrid
--lang LG filter to one language field (e.g. rust, go)
--full N max chars per passage (default 800; 0 = file head only)
@@ -2189,6 +2193,12 @@ mod tests {
assert!(CODE_USAGE.contains(f), "{f} missing from usage");
}
assert!(CORPUS_USAGE.contains("--from"));
+ assert!(
+ CODE_USAGE.contains("Default ranking is lexical")
+ && CODE_USAGE.contains("not a neural reading")
+ && CODE_USAGE.contains("--embed-mode neural"),
+ "{CODE_USAGE}"
+ );
}
/// The `--from` name swap: explicit beats the manifest, the manifest