LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Issue #1449: Search Photos finds named people, and quotes keep a name together (steps 1 and 2)
Arekatla Nishanth Chowdary70c5cdc2858d
diff --git a/README.md b/README.mdindex 2aea14d87..97f22faa9 100644--- a/README.md+++ b/README.md@@ -205,7 +205,8 @@ Then tone it with Color Grading for selenium, sepia or split-tone prints.A library that stays out of your way: **All Photos**, **Recently Added**, **Picks**, **By Date**, **Albums** nested in**Folders**, and **Recently Deleted**. Rate with <kbd>0</kbd>–<kbd>5</kbd>, flag with <kbd>P</kbd> / <kbd>X</kbd> /<kbd>U</kbd>, colour-label with <kbd>6</kbd>–<kbd>9</kbd>. Search understands fields:-`rating:>3 flag:pick iso:>800 camera:x2 date:2026-04 keyword:mountains`. Every view sorts by capture date,+`rating:>3 flag:pick iso:>800 camera:x2 date:2026-04 keyword:mountains person:"Jane Doe"`; plain words also match+the people named on faces, and quotes keep several words together. Every view sorts by capture date,import date, edit date, name, rating, size or at random (a stable shuffle; View → Sort → Reshuffle for a new one). The justified **Photo Grid** and **Square Grid** views are virtualized,so they stay smooth whether you have forty photos or forty thousand.diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rsindex be6ab6cdc..75bb2ca05 100644--- a/crates/catalog/src/query.rs+++ b/crates/catalog/src/query.rs@@ -114,9 +114,40 @@ fn shuffle_rank(seed: u64, id: PhotoId) -> u64 {mix64(mix64(seed) ^ id.0)}+/// The tokens of a search text: split at whitespace, except inside double quotes, so+/// `person:"Jane Doe"` is one token (issue #1449). An unclosed quote runs to the end of the text; a+/// backslash is an ordinary character. One pass over the text, nothing allocated.+fn search_tokens(text: &str) -> impl Iterator<Item = &str> {+ let mut rest = text;+ std::iter::from_fn(move || {+ rest = rest.trim_start();+ if rest.is_empty() {+ return None;+ }+ let mut quoted = false;+ let end = rest+ .char_indices()+ .find(|&(_, c)| {+ quoted ^= c == '"';+ !quoted && c.is_whitespace()+ })+ .map_or(rest.len(), |(i, _)| i);+ let (tok, tail) = rest.split_at(end);+ rest = tail;+ Some(tok)+ })+}++/// `s` without the double quotes around it (a missing closing quote is allowed).+fn unquote(s: &str) -> &str {+ s.strip_prefix('"').map_or(s, |inner| inner.strip_suffix('"').unwrap_or(inner))+}+fn token_matches(p: &Photo, tok: &str) -> bool {let t = tok.to_lowercase();- if let Some((field, val)) = t.split_once(':') {+ // a token that starts with a quote is a phrase, even with a colon in it+ if let Some((field, val)) = t.split_once(':').filter(|_| !t.starts_with('"')) {+ let val = unquote(val);let num = |s: &str| -> Option<(char, f64)> {let (op, rest) = match s.chars().next()? {c @ ('>' | '<' | '=') => (c, &s[1..]),@@ -149,8 +180,11 @@ fn token_matches(p: &Photo, tok: &str) -> bool {_ => false,};}+ let t = unquote(&t);let hay = [&p.file_name, &p.meta.title, &p.meta.caption, &p.meta.camera, &p.meta.lens, &p.meta.location, &p.format];- hay.iter().any(|h| h.to_lowercase().contains(&t)) || p.meta.keywords.iter().any(|k| k.to_lowercase().contains(&t))+ hay.iter().any(|h| h.to_lowercase().contains(t))+ || p.meta.keywords.iter().any(|k| k.to_lowercase().contains(t))+ || p.people().iter().any(|n| n.to_lowercase().contains(t))}/// Whether `p` has a named face region called `name` (case-insensitive).@@ -357,7 +391,7 @@ impl Filter {{return false;}- self.text.split_whitespace().all(|tok| token_matches(p, tok))+ search_tokens(&self.text).all(|tok| token_matches(p, tok))}}diff --git a/crates/catalog/src/tests.rs b/crates/catalog/src/tests.rsindex acfbb1bb1..e90f116e2 100644--- a/crates/catalog/src/tests.rs+++ b/crates/catalog/src/tests.rs@@ -737,3 +737,65 @@ fn cmp_name_ignores_case_without_allocating() {assert_eq!(cmp_name("DSC_0001", "DSC_0002"), Less);assert_eq!(cmp_name("a", "ab"), Less);}++/// Search Photos finds named people in free text, and a quoted value keeps a name of several words+/// together: `person:"Jane Doe"` (issue #1449). Malformed quotes narrow the result or change nothing.+#[test]+fn search_text_finds_people_and_quoted_values() {+ use lightcraft_meta::{Rect, Region, RegionKind};+ let region = |name: &str, kind: RegionKind| Region {+ rect: Rect { x0: 0.4, y0: 0.4, x1: 0.6, y1: 0.6 },+ kind,+ name: Some(name.to_string()),+ description: None,+ };+ let mut c = Catalog::new();+ let mut add = |name: &str, regions: Vec<Region>, keywords: &[&str]| {+ let id = c.alloc_photo_id();+ let mut p = Photo::new(id, Source::Demo { scene: 1 }, name, "JPEG", 6000, 4000, "2026-09-30T10:00:00");+ p.meta.regions = regions;+ p.meta.keywords = keywords.iter().map(|k| k.to_string()).collect();+ c.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();+ id+ };+ let jane = add("a.jpg", vec![region("Jane Doe", RegionKind::Face), region("Rex", RegionKind::Pet)], &[]);+ let both = add("b.jpg", vec![region("Jane Roe", RegionKind::Face), region("John Doe", RegionKind::Face)], &[]);+ let zoe = add("c.jpg", vec![region("Zoë Ångström", RegionKind::Face)], &["New York"]);+ let none = add("d.jpg", vec![], &["york minster"]);+ let q = |text: &str| {+ let mut ids = c.query(&Filter { text: text.into(), ..Default::default() }, &Sort::default());+ ids.sort();+ ids+ };++ // free text: a person's name, any case, any part of it; pets are not people+ assert_eq!(q("jane"), vec![jane, both]);+ assert_eq!(q("DOE"), vec![jane, both]);+ assert_eq!(q("ångström"), vec![zoe]);+ assert!(q("rex").is_empty(), "a pet is not a person");+ // words are still ANDed: b.jpg has a Jane and a Doe, a quoted phrase asks for them together+ assert_eq!(q("jane doe"), vec![jane, both]);+ assert_eq!(q("\"jane doe\""), vec![jane]);++ // fielded: the exact name, of several words when quoted+ assert_eq!(q("person:\"Jane Doe\""), vec![jane]);+ assert_eq!(q("who:\"jane roe\""), vec![both]);+ assert_eq!(q("person:\"Zoë Ångström\""), vec![zoe]);+ assert!(q("person:jane").is_empty(), "person: is the whole name, as before");+ assert!(q("person:Jane Doe").is_empty(), "unquoted, the second word is its own token, as before");+ assert_eq!(q("keyword:\"new york\""), vec![zoe], "other fields take quoted values too");+ assert_eq!(q("person:\"Jane Doe\" a.jpg"), vec![jane], "tokens after a quoted one still count");++ // malformed input never widens the match and never panics+ assert_eq!(q("person:\"Jane Doe"), vec![jane], "an unclosed quote runs to the end");+ assert!(q("person:\"Jane Doe a.jpg").is_empty(), "…and takes the rest of the text with it");+ assert!(q("person:\"\"").is_empty());+ assert!(q("person:").is_empty());+ assert_eq!(q("\""), vec![jane, both, zoe, none], "a lone quote is an empty phrase, like an empty search");+ assert_eq!(q("\"\" jane"), vec![jane, both]);+ assert!(q("\"jane:doe\"").is_empty(), "a quoted phrase is free text even with a colon");+ assert!(q("jane\\\"").is_empty(), "a backslash is an ordinary character");+ let long = format!("person:\"{}", "é ".repeat(50_000));+ assert!(q(&long).is_empty());+ assert_eq!(q(" \t jane \u{3000} "), vec![jane, both], "any whitespace separates tokens");+}diff --git a/docs/parity-checklist.md b/docs/parity-checklist.mdindex 76d91ba3e..75a82083f 100644--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@ -145,7 +145,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).| Id | Feature | Tier | Status | Evidence | Missing / notes ||---|---|---|---|---|---|-| LR-FILT-SEARCH-META | Text search | P0 | ✅ | `cmd:library.filter` (`text`), `crates/ui-egui/src/panels/topbar.rs`, `crates/catalog/src/query.rs` | fielded tokens (`rating:3`, `iso:>800`, `camera:…`); no suggestions dropdown |+| LR-FILT-SEARCH-META | Text search | P0 | ✅ | `cmd:library.filter` (`text`), `crates/ui-egui/src/panels/topbar.rs`, `crates/catalog/src/query.rs` | fielded tokens (`rating:3`, `iso:>800`, `camera:…`); plain words also match the people named on faces; double quotes keep several words in one token (`person:"Jane Doe"`, `"jane doe"`, issue #1449); no suggestions dropdown || LR-FILT-SEARCH-AI | Natural-language search | P2 | ⬜ | | || LR-FILT-RATING | Rating filter | P0 | ✅ | `cmd:library.filter` (`rating`, `ratingOp`), `crates/ui-egui/src/panels/filterbar.rs` | ≥ / = / ≤ stars in the filter bar (`cmd:view.filterBar`) || LR-FILT-FLAG | Flag filter | P0 | ✅ | `cmd:library.filter` (`flag`), `crates/ui-egui/src/panels/filterbar.rs` | picked / rejected / unflagged (one at a time) |@@ -154,7 +154,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).| LR-FILT-KEYWORD | Keyword filter | P1 | ✅ | `cmd:library.filter` (`keyword`), `crates/ui-egui/src/panels/filterbar.rs` | keyword picker || LR-FILT-CAMERA | Camera / lens filter | P1 | ✅ | `cmd:library.filter` (`camera`, `lens`), `crates/ui-egui/src/panels/filterbar.rs` | camera and lens pickers || LR-FILT-LOCATION | Location filter | P2 | ✅ | `cmd:library.filter` (`text`, `ruleSet` field `location`) | free text, or a rule on location / city / state / country (smart albums, `library.filter`) |-| LR-FILT-PEOPLE | People filter | P2 | 🟡 | `cmd:library.filter`, `crates/catalog/src/query.rs` | filter by a person's name (case-insensitive, named Face regions only) from the People view, a filter chip or `person:`; no unnamed / suggested people |+| LR-FILT-PEOPLE | People filter | P2 | 🟡 | `cmd:library.filter`, `crates/catalog/src/query.rs` | filter by a person's name (case-insensitive, named Face regions only) from the People view, a filter chip, `person:` (`person:"Jane Doe"` for a name of several words) or a plain word in Search Photos (part of the name); no People picker in the filter bar and one person at a time (issue #1449); no unnamed / suggested people || LR-FILT-CULL | Culling-score filters | P2 | ✅ | `cmd:library.filter` (`ruleSet` fields `sharpness`, `bestOfGroup`) | Focus and Best of Similar Shots in the rule editor / smart albums || LR-FILT-SORT | Sort | P0 | ✅ | `cmd:library.sort`, `cmd:library.shuffle`, `crates/ui-egui/src/panels/bottombar.rs` | Random sort (seeded, stable under edits; choosing Random or Reshuffle picks a new seed); the shuffle is part of the saved view state; no effect in Recently Added (always newest import first); no colour-label or custom (manual) order || LR-FILT-SAVED | Filter presets [Classic] | P2 | ✅ | `cmd:filter.savePreset`, `cmd:filter.applyPreset`, `cmd:filter.presets`, `cmd:filter.deletePreset`, `crates/ui-egui/src/panels/filterbar.rs` | filter bar → Presets: apply, save current filter, delete (right-click); saved with the library |diff --git a/docs/whats-new.md b/docs/whats-new.mdindex b5c2ac68c..92f09df87 100644--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -2,6 +2,13 @@## 2026-10-13+### Search finds people+- Typing a person's name in Search Photos finds the photos with that named face (issue #1449).+- Quotes keep several words together: `person:"Jane Doe"` finds exactly that person, `"jane doe"` those words side+ by side, and `keyword:"new york"` a keyword of two words.++## 2026-10-13+### Slider drags on large raws- Dragging a slider no longer re-renders the edited photo's filmstrip thumbnail on every frame; it follows once youlet go. On a 64 MP raw the first of those renders decoded the whole file again, which held up the loupe's