mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
The group_by_meta_id dedup window ordered each sibling group by is_main_sibling then fs_name_no_ext, so absent a manual override the gallery entry went to whichever filename sorted first: "(Demo)" beat "(Europe)" beat "(USA)". Two ordering terms now sit between those: a full release outranks a pre-release, then the configured scan.priority.region order decides. Release status comes first because a demo is not a substitute for the game, so a Japanese release wins over a USA demo. scan.priority.region already existed but only steered metadata and artwork selection, so its description is reworded across all locales. Regions live in a JSON column that no covering index can carry, and 0107 measured what one uncovered reference costs this window: the plan drops from `type=index, Using index` to `type=ALL, key=NULL`, four times per gallery page load. 0108 adds a STORED generated column over regions[0] and covers it in idx_roms_sibling_cover instead, so the ranking reads a scalar. The engine keeps it in sync and ALTER TABLE populates existing rows, so no scan hook and no backfill are needed. Pre-release detection matches the filename rather than the parsed `tags` column: tags keep the dumper's casing, and fs_name_no_ext is already in the index. Reordering the priority list changes which rom represents a group, so the cached gallery sidecars are dropped when the setting changes. Closes #1528 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>