feat(facets): facet registry, Batch A server params, genre model v2, facets endpoint
Phase 1 + backend of Phase 2 of the faceted-navigation plan. One
declarative facet registry (services/facet_registry.go) drives the
bookshelf filter system; a drift-guard unit test reflects over the
generated SearchMediaItemsUnifiedParams so a registry entry and its
sqlc.narg block can never disagree silently.
- Nine new filter params on SearchMediaItemsUnified: story_arc,
imprint, edition (scalar-fuzzy), age_rating, format_group,
manga_type, reading_direction (exact), explicit, abridged
(presence-bound bools). Comma = OR-within multi-select on every
text facet; AND-across-facets unchanged.
- Genre model v2 (user rule: a subgenre is not a genre, it's a tag):
genre_lexicon.go rebuilt as shelf set + subgenre->shelf map;
pickSmartGenre picks direct shelf > mapped subgenre > Fiction floor
> empty (unknown-only stays tags-only). Type-words (Manga, Comics,
Graphic Novel) join the demote list. Both 'adventure' and 'action &
adventure' are shelves — provider data uses both and the verified
traces pin them.
- Language filter UX: comma elements normalize through the ingest
language map, so display names ('English') match rows stored as ISO
codes ('en'). The language autocomplete now serves display names.
- NEW GET /api/media-items/facets?facet=X&library_id=... — registry-
driven value+count listing (14 static per-column queries, family-lens
join); language values carry display names; bool/range facets 400.
- Family-lens gates: an explicit hidden-library library_id is now a
403 on the search endpoints (was a silent empty set) — JSON branch
and HTMX grid partial both.
- handlers.ParseMediaSearchParams is the SINGLE param parser for the
search JSON endpoint and the HTMX grid partial; the HTML branch
previously dropped publisher_filter and narrator_filter silently.
Pins: docs/contract_pins.md changelog entries (additive request
params; new facets endpoint). Tests: facet_registry_test.go (shape +
SQL drift guard + library-type union), series_parsing_test.go genre-v2
cases, facets_integration_test.go (param filtering e2e, counts,
language display, 403s) — container runner.
This commit is contained in:
1 parent
7537063cb7
commit
7e586df48a
13 files changed
+2297
-283
No files matched your search
@@ -161,3 +161,22 @@ cover_image_path, has_conflict, format_group, badge`.
|
||||
- `author_filter` / `publisher_filter` are now per-element against the
|
||||
arrays; a comma-joined value is OR-within-facet multi-select. The
|
||||
param NAMES and single-value behavior are unchanged.
|
||||
|
||||
## 2026-10-19 — Faceted navigation Batch A: new filter facets
|
||||
|
||||
- `GET /api/media-items/search` accepts ADDITIVE REQUEST params (query
|
||||
string, response shapes unchanged): `story_arc_filter`,
|
||||
`imprint_filter`, `edition_filter` (scalar-fuzzy),
|
||||
`age_rating_filter`, `format_group_filter`, `manga_type_filter`,
|
||||
`reading_direction_filter` (exact), `explicit_filter`,
|
||||
`abridged_filter` (bool: absent = unset, "true"/"false" = bound).
|
||||
A comma-joined value is OR-within-facet multi-select on every new
|
||||
TEXT facet (the SQL splits via string_to_array). `services/facet_registry.go`
|
||||
is the Go-side source of truth; the drift-guard unit test
|
||||
(`TestFacetRegistrySQLDrift`) pins registry ↔ SQL agreement.
|
||||
- Genre model v2 changes SCANNER OUTPUT (not a wire contract): sidecar
|
||||
genre selection now stores only top-level shelves in `genre`
|
||||
(subgenres become tags mapped to their parent shelf; unknown-only
|
||||
input leaves `genre` empty). Existing rows are unaffected until a
|
||||
rescan/re-extract.
|
||||
|
||||
Reference in new issue
Block a user