diff --git a/web/src/lib/stores/filters.svelte.ts b/web/src/lib/stores/filters.svelte.ts index 40f7ab0..4212eb5 100644 --- a/web/src/lib/stores/filters.svelte.ts +++ b/web/src/lib/stores/filters.svelte.ts @@ -97,8 +97,20 @@ export function filtersToQ(f: FilterState = filters): string { // express "exact root match" (path:"" / path:/ both fall back to "no // filter"), so we leave the server query unfiltered and let the // timeline post-filter to `Path === ''` client-side. + // + // For any non-root folder we want EVERY photo under that subtree, not + // just photos whose `photo_path` is an exact match. PhotoPrism's + // `path:` operator is exact-by-default but supports a trailing `*` + // wildcard: + // path:"2024" → matches only photos directly at `2024/` (none, + // if all files live in date-stamped sub-folders) + // path:"2024*" → matches `2024`, `2024/01`, `2024/02/...`, etc. + // path:"2024/01*" → matches `2024/01` plus descendants — still + // correct for a leaf folder. + // Always append `*` so internal tree nodes return the union of all + // descendant photos and leaves keep returning their direct contents. if (f.folderPath && f.folderPath !== '/') { - parts.push(`path:${quoteIfNeeded(f.folderPath)}`); + parts.push(`path:${quoteIfNeeded(f.folderPath + '*')}`); } if (f.search) parts.push(quoteIfNeeded(f.search)); return parts.join(' ');