GwentAPI / gwentapi

The code for GwentAPI
https://gwentapi.com
BSD 3-Clause "New" or "Revised" License
47 stars 1 forks source link

Card search needs an overhaul #25

Open 901 opened 7 years ago

901 commented 7 years ago

Eithne's name is "Eithn" leading her to not be found by normally searching her name. Unseen Elder's deploy effect has "SpawnUnseen" and "Strengtheninstead" - words should be seperated.

901 commented 7 years ago

Also, how do you search for cards with 2 words or more? What would the URL be? Currently I cant find cards such as "Impera Brigade" by itself. It always gets grouped with "Impera enforcers".

Tri125 commented 7 years ago

The program doesn't have a full blown text search, it's only using a regex to give a basic autocompletion feel. If I understand correctly you searched for Eithne and you had no result. This is an unfortunate expected behavior as the name of the card is Eithné and é with e doesn't match up. Same related issue with card like Alzur's.

As for the second comment, there's nothing for the moment to support such action. The search is just bad at the moment and it needs an overhaul. Plus, it will throw error 400 if the query exceed 10 characters :worried:

It's unfortunately not something I can easily come with a solution and implement in a week of time. What are you working on exactly and how badly do you need this? This will allow me to prioritize the right issues.

I want a good name search and if it's done right I'll be able to expand it to search more fields but cards name will be the first.

901 commented 7 years ago

Currently working on a twitch bot that pulls card info for the chat - its working right now in its current state. The only limitations are from this API's limitations. Some cards are also missing like Blue Stripes Commando. Let me know if theres anything I can do to contribute to the project as well.

Tri125 commented 7 years ago

If you have any idea or expertise about getting good text search with minimal requirement with mongodb you can definitively help just by giving me pointers and links to possible implementations.

How is Blue Stripes Commando missing? If it's from the ?name= query maybe I wasn't clear enough earlier but you should get code 400 for a bad request. The query was being limited to 10 characters for no good, it's documented in the API definition. However, I just finished a new build and you should be able to do minimal search for multiple consecutive words:

https://api.gwentapi.com/v0/cards?name=Blue+Stripes+Commando

Wait 2h for CloudFlare cache to expire if your specific query doesn't work. The new limit will remain undocumented for the time being.

901 commented 7 years ago

I like this new implementation! Great job!

I know a bit about mongo, I can help wherever possible. If you let me know where youre stuck, I can try my best to help out with this.

I'll update my twitch bot with this new implementation.