feat(api): filename: search token — exact case-insensitive filename filter #1437

Merged
chris merged 1 commit from feat/search-filename-token into main 2026-10-29 21:59:02 +01:00
Owner

Adds filename:<value> to the search token grammar (user request: search by exact file name like filename:20161001_150838.jpg).

Behavior

  • Exact, case-insensitive equality against original_assets.original_filename (lower(oa.original_filename) = lower(:param), parameter-bound — no ILIKE pattern chars, no substring/fuzzy).
  • Extension case tolerated: filename:...JPG matches stored .jpg.
  • One distinct value per query: identical duplicates dedupe (keep first); two different values → 400 (exact-equality can never satisfy two names), consistent with the duplicate-year: precedent.
  • Predicate joins the shared SearchRestriction → narrows all legs (browse, thing, lexical, semantic); filter-only filename:X browses the filtered set.
  • Unmatched token (no visible media with that name): not a hard 400 — empties the query (AND semantics) and surfaces the raw token in the summary via additive SearchFilterSummary.unmatchedFilenameTokens, mirroring the unmatched album: precedent. Android tolerant (ignoreUnknownKeys).
  • Owner-scoped + contributions visibility clause, same as the legs.

Tests

+7 parser, +7 service tests (exact match, extension case, no substring, owner scoping incl. foreign same-name file, unmatched summary, AND with person:, filter-only browse + source assertions for the SQL fragment and 4-leg reach). dev.memories.api.search.* + contracts: 121 tests, 0 failures.

Docs

OpenAPI /api/search (q description, SearchTokenFilter.kind enum + filename, new summary property) and docs/wiki/user/search.md token grammar.

Stacked PR for the web UI follows (builds on unmatchedFilenameTokens).

Adds `filename:<value>` to the search token grammar (user request: search by exact file name like `filename:20161001_150838.jpg`). ## Behavior - Exact, case-insensitive equality against `original_assets.original_filename` (`lower(oa.original_filename) = lower(:param)`, parameter-bound — no ILIKE pattern chars, no substring/fuzzy). - Extension case tolerated: `filename:...JPG` matches stored `.jpg`. - One distinct value per query: identical duplicates dedupe (keep first); two **different** values → 400 (exact-equality can never satisfy two names), consistent with the duplicate-`year:` precedent. - Predicate joins the shared `SearchRestriction` → narrows **all** legs (browse, thing, lexical, semantic); filter-only `filename:X` browses the filtered set. - Unmatched token (no visible media with that name): not a hard 400 — empties the query (AND semantics) and surfaces the raw token in the summary via **additive** `SearchFilterSummary.unmatchedFilenameTokens`, mirroring the unmatched `album:` precedent. Android tolerant (`ignoreUnknownKeys`). - Owner-scoped + contributions visibility clause, same as the legs. ## Tests +7 parser, +7 service tests (exact match, extension case, no substring, owner scoping incl. foreign same-name file, unmatched summary, AND with `person:`, filter-only browse + source assertions for the SQL fragment and 4-leg reach). `dev.memories.api.search.*` + contracts: **121 tests, 0 failures**. ## Docs OpenAPI `/api/search` (q description, `SearchTokenFilter.kind` enum + `filename`, new summary property) and `docs/wiki/user/search.md` token grammar. Stacked PR for the web UI follows (builds on `unmatchedFilenameTokens`).
feat(api): filename: search token — exact case-insensitive filename filter
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Deploy review instance (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 14m12s
758d8ef268
Add filename:<value> to the search token grammar: exact, case-insensitive
equality against original_assets.original_filename (parameter-bound, no
ILIKE pattern chars). One distinct value per query: identical duplicates
dedupe keeping the first token, two different values are a structural
400 (an exact-equality filter can never satisfy two names).

The predicate joins the shared SearchRestriction, so it narrows every
search leg (browse, thing, lexical, semantic) and a filter-only
filename: query browses the filtered set. A value matching no visible
media is not a hard 400: it empties the query (AND semantics) and the
raw token surfaces in the summary via the new additive
SearchFilterSummary.unmatchedFilenameTokens, mirroring the unmatched
album: precedent.

Tests: +7 parser, +7 service (exact/extension-case/no-substring/
owner-scoping/unmatched/AND-with-person/filter-only + leg source
assertions), 121 green. OpenAPI + search wiki docs updated.
chris merged commit a4800b8600 into main 2026-10-29 21:59:02 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1437
No description provided.