ApiV2-GraphQL-Docs icon indicating copy to clipboard operation
ApiV2-GraphQL-Docs copied to clipboard

Sort by rating for media recommendations is inconsistent, causes missing results

Open ben-hig opened this issue 4 years ago • 0 comments

The following criteria need to be met to reproduce the issue:

  • The sort order RATING_DESC is used for media recommendations
  • There are multiple pages of recommendations for the media (>25 recommendations)
  • The 25th recommended anime has the same rating score as the 26th anime

Under these conditions, either the 25th or 26th anime sorted by RATING_DESC will not show up in the results when querying by the API. Instead, the other of the two anime will show up both as the last anime on page 1, and the first anime on page 2.

Note that this is also an issue with the RATING sorting method. RATING_DESC is just more intuitive because it matches how AL displays recommendations.

An example is https://anilist.co/anime/11757/Sword-Art-Online/. The results will probably have changed by the time anyone looks at this issue, so I will include a lot of screenshots that illustrate the issue.

As of this moment, this anime has the following recommendations and ratings displayed on AL as the 24th-27th recommendations displayed. As you can see, the 25th (https://anilist.co/anime/21355/ReZERO-Starting-Life-in-Another-World/) and 26th (https://anilist.co/anime/105190/Darwins-Game/) share the same rating.

image

Show SOQL query used
{
  Media(id: 11757) {
    recommendations(sort: RATING_DESC, page: 1) {
      nodes {
        rating
        mediaRecommendation {
          id
          title {
            english
          }
        }
      }
    }
  }
}

Querying the first page results in 25 results, the last of which are the following:

Show first page results

image

Despite Re:ZERO being 25th on the AL page, the API returns Darwin's Game 25th from the API. So we would expect to see Re:ZERO as the first result on the second page from the API, but instead we get these results:

Show second page results

image

So Darwin's Game appears twice in the results, and Re:ZERO does not appear at all.

ben-hig avatar Sep 27 '21 15:09 ben-hig