hummingbird-me / kitsu-tools

:hammer: The tools we use to build Kitsu, the coolest platform for anime and manga
https://kitsu.io
Apache License 2.0
2.09k stars 265 forks source link

I can't filter animes and sort by favoritesCount using API #795

Closed omarlopesino closed 7 years ago

omarlopesino commented 7 years ago

Thank you for taking the time to open an issue!

For bug reports please include the following section in your issue details.


Description: I tried use the api to get a filter of animes by year and get it sorted by popularityRank and I get Internal server error response:

{ "errors": [ { "title": "Internal Server Error", "detail": "Internal Server Error", "code": "500", "status": "500" } ] }

Steps to reproduce: This is the curl command I am using:

curl --globoff "https://kitsu.io/api/edge/anime?sort=favoritesCount&filter[year]=2017" -v -H "Content-Type: application/vnd.api+json" Screenshots (if applicable):

OS and Browser: Linux. No browser.

matthewdias commented 7 years ago

you can sort by userCount to sort by popularity. -userCount for descending.

trmcnvn commented 7 years ago

Thanks for the report! It looks like that filter can't be used with that sort due to our ElasticSearch instance not having any knowledge about the favorites_count.

Happy to accept a PR for this, or will be fixed when someone can find some time.

omarlopesino commented 7 years ago

Filtering by userCount works, with this url https://kitsu.io/api/edge/anime?sort=userCount&filter[year]=2017 , thanks!

omarlopesino commented 7 years ago

Here is the PR https://github.com/hummingbird-me/hummingbird-server/pull/155, it's only needed that change, right?

matthewdias commented 7 years ago

Thanks!