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(autoindex): name each dataset slug on the map summary (#1693)

xerj-org09705bf73869
diff --git a/engine/crates/xerj-autoindex/src/catalog.rs b/engine/crates/xerj-autoindex/src/catalog.rs
index dd9c05985..119a859b7 100644
--- a/engine/crates/xerj-autoindex/src/catalog.rs
+++ b/engine/crates/xerj-autoindex/src/catalog.rs
@@ -747,9 +747,12 @@ pub fn render_map_page(
}
s.push('\n');
}
- s.push_str("## Datasets\n\n");
- s.push_str("| index | records | files | formats | time field | time range |\n");
- s.push_str("|---|---|---|---|---|---|\n");
+ s.push_str(&format!("## Datasets ({})\n\n", datasets.len()));
+ // `slug` is the argument to `--dataset`. The index name is
+ // `{prefix}-{slug}`, and a hyphenated prefix makes the slug impossible
+ // to recover from the index column alone.
+ s.push_str("| slug | index | records | files | formats | time field | time range |\n");
+ s.push_str("|---|---|---|---|---|---|---|\n");
for d in datasets {
let g = |k: &str| d.get(k).map(pretty_val).unwrap_or_default();
let range = match (d.get("time_min"), d.get("time_max")) {
@@ -758,8 +761,14 @@ pub fn render_map_page(
}
_ => "—".into(),
};
+ let slug = g("slug");
s.push_str(&format!(
- "| `{}` | {} | {} | {} | {} | {} |\n",
+ "| {} | `{}` | {} | {} | {} | {} | {} |\n",
+ if slug.is_empty() {
+ "—".into()
+ } else {
+ format!("`{slug}`")
+ },
g("index_name"),
g("record_count"),
g("file_count"),
@@ -1060,6 +1069,18 @@ mod duplicate_tests {
"summary table lists every dataset"
);
assert!(rendered.contains("`ax-d19`"));
+ assert!(
+ rendered.contains("## Datasets (20)"),
+ "the heading names how many datasets the table holds: {rendered}"
+ );
+ assert!(
+ rendered.contains("| slug |"),
+ "the summary names the slug `--dataset` takes"
+ );
+ assert!(
+ rendered.contains("`d00`") && rendered.contains("`d19`"),
+ "every row carries its slug, not only its index name: {rendered}"
+ );
assert_eq!(
rendered.matches("### `").count(),
super::MAP_DETAIL_PAGE,