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 <noreply@anthropic.com>
This commit is contained in:
Nathaniel Ledford
2026-10-09 10:54:56 -04:00
co-authored by Claude Opus 5.5
parent 5fa77aa878
commit 5d86976b82
+28
View File
@@ -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]