fix(search): face:unassigned zeigt nur undatierte Bilder; date:none + Jahres-Vergleiche #1176

Merged
chris merged 4 commits from feat/search-date-filters into main 2026-10-13 00:43:03 +02:00
Owner

Summary

Bug: face:unassigned (und andere Filter-Only-Suchen) zeigte im Ergebnis nur undatierte Bilder, obwohl kein Datum-Filter aktiv war. Ursache: die Such-Beine sortierten mit COALESCE(capture_timestamp, created_at) DESC — undatierte Medien fielen auf ihr Import-Datum zurück (oft neuer als jedes Foto-Datum) und verdrängten bei LIMIT 100 alle datierten Medien (verifiziert: 8.618 datierte vs. 321 undatierte mit unassigned Faces; die Top-100 der alten Sortierung waren zu 100 % undatiert).

Fix: datierte Medien zuerst (nach Aufnahmedatum, NULLS LAST), undatierte danach nach Import-Datum. Die Sortier-Expression folgt dem capture_override-Join (effektives Aufnahmedatum); das thingRows-Bein (GROUP BY) aggregiert sie via MAX(), damit PostgreSQL nicht auf eine nicht gruppierte Spalte flippt.

Neu:

  • date:none — Filter „kein Datum" (effektives Aufnahmedatum ist NULL, inkl. Override-Semantik); im Jahr-Menü der Suche als „Ingen dato"-Option, als entfernbarer „No date"-Chip.
  • Jahres-Vergleiche: year:<2020, year:<=2020, year:>2020, year:>=2021 — werden in die bestehende from/to-Logik desugart, kombinierbar zu Bereichen (year:>=2021 year:<2024). Frontend erkennt Vergleichs-Tokens als Chips; das Jahr-Menü zeigt „Alle år", ohne das Token zu zerstören.

Tests

  • rtk ./gradlew :apps:api:test --tests 'dev.memories.api.search.*': 99 Tests, 0 Fehler (SearchQueryParserTest 35, SearchServiceTest 62, SearchStatsIndexesMigrationTest 2)
  • rtk npm run test:unit (apps/web): 169 Tests, grün; npm run check: 0 Fehler
  • Regressionstest pinnt die thingRows-Aggregation auf Quell-Ebene (H2-Harness erzwingt die PG-GRUPPIERREGEL nicht)

Known Issues

[ISSUE-142] wird durch dieses PR auf resolved gesetzt (Ref wird nach Merge aktualisiert).

## Summary **Bug:** `face:unassigned` (und andere Filter-Only-Suchen) zeigte im Ergebnis nur undatierte Bilder, obwohl kein Datum-Filter aktiv war. Ursache: die Such-Beine sortierten mit `COALESCE(capture_timestamp, created_at) DESC` — undatierte Medien fielen auf ihr Import-Datum zurück (oft neuer als jedes Foto-Datum) und verdrängten bei LIMIT 100 alle datierten Medien (verifiziert: 8.618 datierte vs. 321 undatierte mit unassigned Faces; die Top-100 der alten Sortierung waren zu 100 % undatiert). **Fix:** datierte Medien zuerst (nach Aufnahmedatum, `NULLS LAST`), undatierte danach nach Import-Datum. Die Sortier-Expression folgt dem `capture_override`-Join (effektives Aufnahmedatum); das `thingRows`-Bein (GROUP BY) aggregiert sie via `MAX()`, damit PostgreSQL nicht auf eine nicht gruppierte Spalte flippt. **Neu:** - `date:none` — Filter „kein Datum" (effektives Aufnahmedatum ist NULL, inkl. Override-Semantik); im Jahr-Menü der Suche als „Ingen dato"-Option, als entfernbarer „No date"-Chip. - Jahres-Vergleiche: `year:<2020`, `year:<=2020`, `year:>2020`, `year:>=2021` — werden in die bestehende from/to-Logik desugart, kombinierbar zu Bereichen (`year:>=2021 year:<2024`). Frontend erkennt Vergleichs-Tokens als Chips; das Jahr-Menü zeigt „Alle år", ohne das Token zu zerstören. ## Tests - `rtk ./gradlew :apps:api:test --tests 'dev.memories.api.search.*'`: 99 Tests, 0 Fehler (SearchQueryParserTest 35, SearchServiceTest 62, SearchStatsIndexesMigrationTest 2) - `rtk npm run test:unit` (apps/web): 169 Tests, grün; `npm run check`: 0 Fehler - Regressionstest pinnt die thingRows-Aggregation auf Quell-Ebene (H2-Harness erzwingt die PG-GRUPPIERREGEL nicht) ## Known Issues [ISSUE-142] wird durch dieses PR auf `resolved` gesetzt (Ref wird nach Merge aktualisiert).
Undated media (effective capture NULL falling back to import created_at)
crowded dated media out of the search browse/lexical/thing legs within
LIMIT 100 (face:unassigned with All years showed only undated items).
ORDER BY is now effective-capture DESC NULLS LAST, created_at DESC,
id DESC, using the override-coalesced expression only when the leg
joins capture_override (capture range or date:none active).

New query tokens:
- date:none matches media whose effective capture is null (override-
  coalesced); AND-combines with year/from/to (unsatisfiable -> empty).
- year:<2020 / year:<=2020 / year:>2020 / year:>=2021 desugar into the
  from/to range machinery (strict < ends at Y-1-12-31, > starts at
  Y+1-01-01) and merge via earliest()/latest(); malformed values stay
  free text; exact+comparison mixes keep the existing 400.
- queryTokens: 'date' key (value 'none' only) and year values now accept
  comparisons (year:<2020, year:<=2020, year:>2020, year:>=2021); chips
  render and remove both via the existing raw-token mechanics.
- FilterSortMenu: optional yearNoneLabel adds an 'Ingen dato' option to
  the year select (value 'none').
- Search page: the year select writes/clears the date:none token like a
  concrete year (clearing year/from/to), reflects date:none back as the
  selected option, shows 'Alle år' for unrepresentable comparison tokens
  while keeping them in the query, adds a 'No date' chip, and counts the
  tokens in the filter badge.
fix(api): aggregate capture order expression in thingRows grouping
Some checks failed
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
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 plants worker image (push) Has been skipped
Build and Deploy / Build converter 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 people 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 / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Failing after 12m45s
091b364849
docs: renumber search ordering issue to ISSUE-143, ref PR#1176
Some checks failed
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 / Android unit tests and debug APK (push) Has been skipped
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 plants worker image (push) Has been skipped
Build and Deploy / Build converter 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 people 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 / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Failing after 12m8s
4e05b36e4e
chris merged commit 33af2a7897 into main 2026-10-13 00:43:03 +02: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!1176
No description provided.