-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow dual-face cards to be found by their collector number #613
Conversation
The collector numbers of dual-face cards are internally represented as NNNa and NNNb for the front and back face respectively. This means that a user searching for the collector number NNN will not find either face. Correct this by including the 'a' and 'b' variants in our search when the user searches for only a number. Ideally these would be two separate structured fields, but that is left to a future refactor. Small notes ---------------------------------------------------------------------- Performance impact seems to be minimal (This already fast search may perform up to 3x slower). In practice a search over the entire history of magic cards still completes in milliseconds. The 'a' and 'b' scheme is somewhat hardcoded now, hopefully no new cards are printed with a 3rd face. I'm sure the string concatenation here is slow, but it's a small price to pay for its convenience.
Un- sets are the worst, and "Who // What // Where // When // Why" has a, b, c, d, and e numbers. Instead of appending the search with more |
I considered this, except a It's a bummer it is actually more complicated. That may mean that it makes sense to try to handle the data as it gets imported and keep the collector number row numeric and have separate rows for these modifiers. I just didn't want to have to deal with the fact that would need a whole database migration (via dropping and rebuilding or some kind of patch). I may look at that more seriously. Thanks for the feedback! |
Fair point with the wildcard. I checked the db and here's the list of non-numeric collector's numbers: odd-numbers.txt. You get the |
Shame that the |
Yup, you are definitely right. I think the right approach here is to parse the data into more rows when importing it. I'm not sure I'm going to be able to do that without a bit of help finding how the data is imported and a bit of knowledge about how database migrations typically are run. Do they happen on app update? Is there a common pattern for them? |
There's an informal pattern for adding card data columns to the database
The database is compressed and included in the APK, so everyone will just get it with an app update. I'll handle that part. What column(s) exactly are you looking to add? |
Not worth the effort? |
Oh, I'm just closing this pull request because the changes here aren't going to be the right solution. I'll open a new one once I've got a better diff :) I do have to find a few hours to sit down and do it though, hopefully I can find that in a week or two. My thought as far as a patch is to re-organize how data is imported. There should be a column that's strictly numeric, one for the card face, maybe one for the promo star, and then a string that's the raw collector number. I'll have to write a parser that takes all the crazy data from the data source and splits up into those columns |
Ah gotcha. Just remember that whatever solution you come up with should be as future-proof as possible (which is tough when WotC does new stuff all the time). The simple two-column solution (one is only numeric, the other is the full string) may be good enough here. |
The collector numbers of dual-face cards are internally represented as NNNa and NNNb for the front and back face respectively.
This means that a user searching for the collector number NNN will not find either face.
Correct this by including the 'a' and 'b' variants in our search when the user searches for only a number.
Ideally these would be two separate structured fields, but that is left to a future refactor.
Small notes
Performance impact seems to be minimal (This already fast search may perform up to 3x slower). In practice a search over the entire history of magic cards still completes in milliseconds.
The 'a' and 'b' scheme is somewhat hardcoded now, hopefully no new cards are printed with a 3rd face.
I'm sure the string concatenation here is slow, but it's a small price to pay for its convenience.
Fixes #611