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.

style: rustfmt pass on the date-detection changes (CI fmt gate)

xerj-org85656756e153
diff --git a/engine/crates/xerj-engine/src/engine.rs b/engine/crates/xerj-engine/src/engine.rs
index 28716fd16..a1a88f776 100644
--- a/engine/crates/xerj-engine/src/engine.rs
+++ b/engine/crates/xerj-engine/src/engine.rs
@@ -820,7 +820,11 @@ impl Engine {
pub(crate) fn mapping_date_detection(mapping: &Value) -> bool {
mapping
.get("date_detection")
- .or_else(|| mapping.get("mappings").and_then(|m| m.get("date_detection")))
+ .or_else(|| {
+ mapping
+ .get("mappings")
+ .and_then(|m| m.get("date_detection"))
+ })
.and_then(Value::as_bool)
.unwrap_or(true)
}
@@ -828,11 +832,9 @@ impl Engine {
/// Top-level date fields carrying an explicit `format` or
/// `ignore_malformed` in the raw mapping blob (either shape).
fn mapping_date_exclusions(mapping: &Value) -> std::collections::HashSet<String> {
- let props = mapping.get("properties").or_else(|| {
- mapping
- .get("mappings")
- .and_then(|m| m.get("properties"))
- });
+ let props = mapping
+ .get("properties")
+ .or_else(|| mapping.get("mappings").and_then(|m| m.get("properties")));
let mut out = std::collections::HashSet::new();
let Some(obj) = props.and_then(Value::as_object) else {
return out;
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rs
index 23995b2d6..f9ef32a11 100644
--- a/engine/crates/xerj-engine/src/index.rs
+++ b/engine/crates/xerj-engine/src/index.rs
@@ -11810,11 +11810,13 @@ impl Index {
Value::String(s) => s.chars().take(64).collect(),
other => other.to_string().chars().take(64).collect(),
};
- return Err(EngineError::Common(xerj_common::XerjError::InvalidMapping {
- reason: format!(
- "failed to parse field [{key}] of type [date] with value [{preview}]"
- ),
- }));
+ return Err(EngineError::Common(
+ xerj_common::XerjError::InvalidMapping {
+ reason: format!(
+ "failed to parse field [{key}] of type [date] with value [{preview}]"
+ ),
+ },
+ ));
}
}
Ok(())
@@ -19883,7 +19885,7 @@ pub(crate) fn default_format_date_value_ok(v: &Value) -> bool {
return false;
}
match b.len() {
- 4 => true, // yyyy
+ 4 => true, // yyyy
7 => b[4] == b'-' && b[5].is_ascii_digit() && b[6].is_ascii_digit(), // yyyy-MM
_ => {
// yyyy-MM-dd with an optional T… time tail. The tail is
@@ -26923,7 +26925,10 @@ mod date_detection_tests {
serde_json::json!({"nested": 1}),
serde_json::json!(["2026-07-25", "n/a"]),
] {
- assert!(!default_format_date_value_ok(&bad), "{bad} must be rejected");
+ assert!(
+ !default_format_date_value_ok(&bad),
+ "{bad} must be rejected"
+ );
}
}
}