mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
* Search the gallery by providers' alternative titles A search for "FF9" or "Final Fantasy 9" did not find "Final Fantasy IX": the gallery search only matched roms.name and roms.fs_name, while the alternative titles IGDB, MobyGames and ScreenScraper report lived in the raw metadata blobs where no index reaches. Add generated_search_aliases, a STORED generated column the engine fills from those blobs, so every write path (scans, metadata refreshes, the bulk update_rom, raw metadata edits) keeps it current with no backfill. Migration 0145 rebuilds the MariaDB/MySQL FULLTEXT index over (name, fs_name, aliases) and adds a pg_trgm GIN index on PostgreSQL, and the search matches the column on both paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy * Compare the alias JSON type under the table's collation On a utf8mb3_unicode_ci table, JSON_TYPE's result and the 'ARRAY' literal carry different collations, so creating the generated column failed with an illegal mix. CAST re-derives it, as _maria_text does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy * pr-ready step 2 (code-review): defer the alias column, share search columns Loading a ROM no longer fetches generated_search_aliases, which only the gallery search reads. The FULLTEXT match and the ILIKE fallback both take their columns from one ROM_SEARCH_COLUMNS tuple. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy * pr-ready step 3 (simplify): register the search indexes, share the CAST Both search indexes join the generated-column index registry, so any later rebuild of the alias column puts them back instead of leaving MariaDB's FULLTEXT index narrowed (and every MATCH failing) or the PostgreSQL trgm index gone. 0145 shrinks to ensure_roms_columns plus retiring 0084's index, and its downgrade guards DROP COLUMN with has_column, since MySQL has no DROP COLUMN IF EXISTS. _maria_char carries the collation CAST that _maria_text and the alias expression share, the alias expression extracts each array twice instead of three times, and the dialect test runs the handler's own _fulltext_match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy * Store the search aliases as plain titles The alias column held each provider's array as JSON text, so a short ILIKE search for '"', ',' or '[' matched every ROM with any alias. Both engines print an array as ["a", "b"] however it was stored, so the expression strips the brackets and quotes and keeps the titles separated by spaces, which search terms can never match on their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy * Shorten the alias-search docstrings to one sentence The migration and test-module docstrings explained the design in several paragraphs; AGENTS.md asks for one sentence. The design notes live in the PR description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>