From 5d86976b821dd27fdbd590180a4eb712e3bcff20 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Fri, 9 Oct 2026 07:05:55 -0400 Subject: [PATCH] LRC-LIB-SMARTCOLL: Any Searchable Text covers state, alt text, people, copy name The any-text rule already searched the city and country but skipped the state / province. It now also searches the alt text, the people on faces and a virtual copy's name, so it agrees with the dedicated fields. Co-Authored-By: Claude Opus 5.5 --- crates/catalog/src/rules.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/catalog/src/rules.rs b/crates/catalog/src/rules.rs index 6e97fc667..8975ce3b9 100644 --- a/crates/catalog/src/rules.rs +++ b/crates/catalog/src/rules.rs @@ -398,9 +398,13 @@ impl Rule { &m.lens, &m.location, &m.city, + &m.state, &m.country, + &m.alt_text, &p.format, &m.keywords.join(" "), + &p.people().join(" "), + p.copy_name.as_deref().unwrap_or(""), ] .join(" "); text(&all) @@ -797,6 +801,30 @@ mod tests { ); } + /// Any Searchable Text also finds the state / province, the alt text, a person on a face and + /// a virtual copy's name, as it already finds the city and country. + #[test] + fn any_searchable_text_covers_new_fields() { + let cat = Catalog::new(); + let mut p = photo(1); + let m = |p: &Photo, value: &str| rs(json!({"rules": [{"field": "text", "op": "contains", "value": value}]})).matches(p, &cat); + for word in ["oregon", "kite", "ana", "bluish"] { + assert!(!m(&p, word), "{word}"); + } + p.meta.state = "Oregon".into(); + p.meta.alt_text = "A kite".into(); + p.meta.regions = vec![lightcraft_meta::Region { + rect: lightcraft_meta::Rect { x0: 0.4, y0: 0.4, x1: 0.6, y1: 0.6 }, + kind: lightcraft_meta::RegionKind::Face, + name: Some("Ana".into()), + description: None, + }]; + p.copy_name = Some("Bluish".into()); + for word in ["oregon", "kite", "ana", "bluish"] { + assert!(m(&p, word), "{word}"); + } + } + /// The field menu shows every rule field once: at the top level or in exactly one group, /// and [`FIELDS`] lists them in menu order. #[test]