Add age rating browser filters and rename FTS age_rating column#565
Merged
ajslater merged 1 commit intoage-filterfrom Apr 21, 2026
Merged
Add age rating browser filters and rename FTS age_rating column#565ajslater merged 1 commit intoage-filterfrom
ajslater merged 1 commit intoage-filterfrom
Conversation
Adds two new browser filter options ("Age Rating" for the normalized
metron_age_rating and "Age Rating (Tagged)" for the original age_rating FK)
and reworks the FTS schema so the two age ratings are indexed separately.
- Rename the ComicFTS age_rating column to tagged_age_rating and add a
new metron_age_rating column. Search aliases "age" and "age_rating" now
map to metron_age_rating; tagged_age_rating is keyed-only.
- Register metron_age_rating in BROWSER_FILTER_KEYS and the filter/choice
serializers so the frontend menu surfaces it automatically. Frontend
filter sub-menu adds an FILTER_TITLE_OVERRIDES map so the two ratings
render as "Age Rating" and "Age Rating (Tagged)".
- Importer: drop metron_age_rating from NON_FTS_FIELDS so the plain
CharField flows into FTS, and apply FTS_FIELD_RENAME_MAP when writing
the age_rating FK's linked name to FTS so it lands under
tagged_age_rating.
- Migration 0040: add SettingsBrowserFilters.metron_age_rating JSONField
and drop+recreate the codex_comicfts virtual table with the new schema
(it is rebuilt on the next librarian sync).
- Update importer test fixtures to reflect the new FTS key layout.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two browser filter options — Age Rating (the normalized
metron_age_rating) and Age Rating (Tagged) (the originalage_ratingFK) — and reworks the FTS schema so the two ratings are indexed separately.metron_age_ratingis registered inBROWSER_FILTER_KEYS, filter serializers, and the frontend filter sub-menu (with aFILTER_TITLE_OVERRIDESmap so the two rating fields render as Age Rating and Age Rating (Tagged)).ComicFTS.age_ratingcolumn is renamed totagged_age_rating; a newmetron_age_ratingFTS column is added. The search aliasesageandage_ratingnow map tometron_age_rating(not to the tagged rating).metron_age_ratingis removed fromNON_FTS_FIELDSso the Comic CharField flows into FTS. AnFTS_FIELD_RENAME_MAPredirects theage_ratingFK's linked name totagged_age_ratingat FTS-write sites.SettingsBrowserFilters.metron_age_ratingJSONField and drops + recreates thecodex_comicftsvirtual FTS5 table with the new schema (repopulated on the next librarian sync).Test plan
uv run python -m codex.manage makemigrations --check codex— cleanuv run python -m codex.manage migrate—0040_fts_age_ratingapplied; FTS virtual table schema verified viadbshellmake fix-python/make lint-python— clean (ruff, basedpyright, vulture, complexipy, codespell)uv run pytest— 5 passed (all 3 previously-failing importer tests now green)age:Teen/age_rating:Teenhitsmetron_age_rating;tagged_age_rating:<value>hits the original FK name🤖 Generated with Claude Code