Fix multilingual card search support #1
+86
−22
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.
A little issue I found
I was using the app for a couple days on my homelab, and I loved it! The minor issue I found is that cards could only be searched by their English names, for example, searching for "Ajani Melena Dorada" (Spanish for "Ajani Goldmane") returns no results. This was rather inconvenient because I own some cards in different languages, partly because of CardMarket purchases, or my local stores, which sell mostly translated versions. Manually translating them took long, but I noticed MTGJSON provides foreign card names, and the database already contains a
card_foreign_datatable, so it could be automatedWhy I think this happened
The import script was using the
faceNamefield from MTGJSON’s foreign data, which I found was apparently only populated for multi-face cards. For single-face cards, this field was null, leaving theforeign_namecolumn empty. After some testing, I found out that MTGJSON actually stores all foreign names in anamefield, it is quite confusing.Changes I made
foreign_namecolumn to improve search performance.Testing
All multilingual search tests were conducted comparing results to Gatherer's translations
Usage Impact
As an example, users can now perform searches like "Gegenzauber" or "対抗呪文" and obtain the "Counterspell" card as a result.
Benefits
Migration Notes
It is necessary to reimport card data for this fix to take effect. This can be done with the import script or by setting
FORCE_REIMPORT=true(default in the project's compose file) and restarting the container.