ontehfritz / api.mtgdb.info

Project closing first of August 2015
http://www.mtgdb.info/
MIT License
36 stars 8 forks source link

Card search fails with punctuation #77

Closed Lithl closed 10 years ago

Lithl commented 10 years ago

[http://api.mtgdb.info/cards/Jace, the Mind Sculptor](http://api.mtgdb.info/cards/Jace, the Mind Sculptor): Empty array [http://api.mtgdb.info/cards/Jace the Mind Sculptor](http://api.mtgdb.info/cards/Jace the Mind Sculptor): Two results (expected)

http://api.mtgdb.info/cards/Incoming!: Empty array http://api.mtgdb.info/cards/Incoming: One result (expected)

[http://api.mtgdb.info/cards/Garruk's Horde](http://api.mtgdb.info/cards/Garruk's Horde): Empty array [http://api.mtgdb.info/cards/Garruks Horde](http://api.mtgdb.info/cards/Garruks Horde): Two results (expected)

ontehfritz commented 10 years ago

Hey @Lithl That is documented on api page, when calling a "card by name" it isn't the search method (but search probably behaves the same, I have to test advanced search still). You need to strip out the non alpha-numeric, spaces are ok. But, yes there are some nuances and punctuation with the api. For now just strip it out and you should be good to go.

From api page: Get cards by name Get http://api.mtgdb.info/cards/[name] This method returns an array of cards not a single card. When calling by name, strip all non alphanumeric characters in the name. For example: "Circle of Protection: Red" will cause an error because of the colon. "Circle of Protection Red" is the proper format.

ontehfritz commented 10 years ago

We will get to these issues though, we just need the time ;)

ontehfritz commented 10 years ago

This is up next for the api release!

ontehfritz commented 10 years ago

As per Pablo Bollansée via email:

I just found that when I try to get the info for Lead-Belly Chimera I have to use the url "http://api.mtgdb.info/cards/Lead%20Belly%20Chimera" instead of "http://api.mtgdb.info/cards/Lead-Belly%20Chimera", notice that in the first I use "%20" instead of the "-" in its name. Is this intended behaviour? And if so, are there any other special characters that get replaced in the names?

ontehfritz commented 10 years ago

This is now fixed the only issue is colons (:) ASP.net handler does not like this in the URL a know issue. It is ok in query string but part of a url path in MVC style it does not like. All the above examples work!

Also another note on this issue is only english characters are supported currently, we will resolve this and use the exact name with special characters. There is a separate issue already created for this.

Lithl commented 10 years ago

What about non-ASCII characters? I know that the db correctly handles mapping the accented/etc. characters from plain ASCII, but sometimes (eg, a file dump) we've got the actual letter on the card.

I believe this is the full list of cards with non-ASCII characters as of JOU:

Ærathi Berserker
Æther Adept
Æther Barrier
Æther Burst
Æther Charge
Æther Figment
Æther Flash
Æther Membrane
Æther Mutation
Æther Rift
Æther Shockwave
Æther Snap
Æther Spellbomb
Æther Sting
Æther Storm
Æther Tide
Æther Tradewinds
Æther Vial
Æther Web
Ætherflame Wall
Ætherize
Ætherling
Æthermage's Touch
Ætherplasm
Æthersnipe
Æthertow
Arm with Æther
Azorius Æthermage
Bösium Strip
Dandân
Déjà Vu
El-Hajjâj
Fold into Æther
Frozen Æther
Gate to the Æther
Ghazbán Ogre
Ifh-Bíff Efreet
Jötun Grunt
Jötun Owl Keeper
Junún Efreet
Juzám Djinn
Khabál Ghoul
Legions of Lim-Dûl
Lim-Dûl the Necromancer
Lim-Dûl's Cohort
Lim-Dûl's Hex
Lim-Dûl's High Guard
Lim-Dûl's Paladin
Lim-Dûl's Vault
Márton Stromgald
Oath of Lim-Dûl
Ring of Ma'rûf
Scornful Æther-Lich
Séance
Surging Æther
Tainted Æther
Unravel the Æther
Vedalken Æthermage

As there are only a handful of non-ASCII characters to consider and the service already correctly recognizes their ASCII equivalents (eg, Æ -> Ae), it oughtn't be an onerous addition.

Æ ö â é à â á í ú û
ontehfritz commented 10 years ago

Thanks for the list! Yes, we will get this resolved as well. I will start work on it next week. I know this is important when matching other sources to mtgdb.info.