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.

Integrate Markdown and empty-file fixes without regressing main's titles

xerj-org79bc2c117c30
diff --cc engine/crates/xerj-autoindex/src/extract/txt.rs
index ca119b1c8,44d410ebf..345566fb7
--- a/engine/crates/xerj-autoindex/src/extract/txt.rs
+++ b/engine/crates/xerj-autoindex/src/extract/txt.rs
@@@ -543,7 -397,17 +543,34 @@@ mod chunk_tests
};
extract_prose(&p, false, &mut sink).unwrap();
}
- assert_eq!(titles, vec!["# Outage postmortem".to_string()]);
+ let _ = std::fs::remove_file(&p);
+ assert_eq!(titles, ["Deploy runbook"]);
}
+
- /// An unterminated opening `---` is a horizontal rule, not a fence, so the
- /// title stays the first line.
+ #[test]
- fn an_unterminated_fence_does_not_hide_the_title() {
- assert_eq!(frontmatter_end("---\nJust prose.\n"), None);
- assert_eq!(
- frontmatter_end("---\ntitle: x\n---\nbody\n"),
- Some("---\ntitle: x\n---\n".len())
- );
++ fn short_markdown_frontmatter_keeps_its_title_and_complete_body() {
++ let dir = tempfile::tempdir().unwrap();
++ for extension in [
++ "md", "MD", "markdown", "mdx", "mdown", "mkd", "mkdn", "mdwn",
++ ] {
++ let path = dir.path().join(format!("install.{extension}"));
++ let text = "---\ntitle: Install guide\n---\n\n- npm\n- pnpm\n- yarn\n";
++ std::fs::write(&path, text).unwrap();
++ assert_eq!(
++ crate::sniff::sniff(&path).unwrap().family,
++ crate::sniff::Family::TxtProse,
++ "short body must survive the YAML-looking bullets: {extension}"
++ );
++ let mut records = Vec::new();
++ extract_prose(&path, false, &mut |record| {
++ records.push(record);
++ true
++ })
++ .unwrap();
++ assert_eq!(records.len(), 1);
++ assert_eq!(records[0].fields["title"], "Install guide");
++ assert_eq!(records[0].fields["body"], text.trim());
++ assert_eq!(records[0].fields["start_line"], 1);
++ }
+ }
}