Repository navigation
Multilingual card search (integrates #1 by @w-dan) - #5
Merged
Merged
Conversation
- Updated import script to use fd.name instead of fd.faceName for foreign card names - Added index on foreign_name for better search performance - Modified searchCards to query card_foreign_data table - Searches now work with Spanish, Japanese, German, French, etc. card names
- Fixed foreign name field - Added index on foreign name + FTS fallback
Integrates w-dan's multilingual search so cards can be found by their foreign names, resolved against current main. Conflict resolution (src/services/cardService.js): - searchCards() on main had gained a `typeFilter` param; the PR was written against an older signature and dropped it. Combined both: foreign-name matching AND the type filter, so the price-watch card type filter keeps working. - Parenthesised the name-match OR group so the type filter ANDs against the whole group rather than only the last OR branch. - Dropped redundant LIMIT 1 inside EXISTS(). Integration fixes: - Moved the idx_foreign_name index out of migration 010 (already applied on existing installs, so it would never have run for them) into new migration 020-add-foreign-name-index.js using CREATE INDEX IF NOT EXISTS. - Removed 017-add-card-search-fts.js: it collided with the existing 017-add-price-watches.js and created an FTS5 table that was never populated or queried (the PR's own 5cac99c had already dropped FTS as unnecessary). Co-Authored-By: Dani <d.galgora@upm.es>
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.
Integrates @w-dan's multilingual card search from #1, rebased onto current
mainwith the merge conflict resolved and a few integration fixes.All feature credit goes to @w-dan (Dani) — see #1 for the original work and write-up. Closes #1.
What the feature does
Cards can now be found by their foreign names (e.g. "Gegenzauber" or "対抗呪文" → Counterspell). The root cause was the import script reading
fd.faceName, which MTGJSON only populates for multi-face cards, leavingforeign_namenull for single-face cards; it now readsfd.name.Conflict resolution (
src/services/cardService.js)searchCards()onmainhad since gained atypeFilterparameter (used by the price-watch card type filter viasrc/routes/cards.js). The PR was written against the older two-arg signature and dropped it, so merging as-is would have silently broken the card type filter.typeFilter.ORgroup so the type filter ANDs against the whole group rather than only the lastORbranch.LIMIT 1insideEXISTS().Integration fixes
idx_foreign_namewas added inside migration010, which is already applied on existing installs — the runner would never re-run it, so only fresh databases would get the index. Now in020-add-foreign-name-index.jsusingCREATE INDEX IF NOT EXISTS.017-add-card-search-fts.js. It collided with the existing017-add-price-watches.js, and the FTS5 table it created was never populated or queried. The original PR's own commit5cac99c "Removed FTS search (found to be unnecessary)"had already dropped FTS usage but left the migration behind.Notes for testing
The import-script change only takes effect after a card database re-import, so this needs a Docker run with a re-import to see multilingual results.
Two things worth knowing (both pre-existing, not regressions):
LIMIT.EXISTS(... LIKE '%query%')joined oncard_name = c.name, which can't use the new index; may be slow on a largecard_foreign_datatable.