I have a table of movies and a table of reviews
In my app, I want to show top 10 movies of any genre.
I clearly cannot sort movies just by rating since there are movies with only 1 5 star review, thus only irrelevant movies will be recommended to users.
Currently I receive from DB top 100 movies in this genre sorted by reviews, sort this list by rating on server and only then display top 10.
That kinda works but this solution is impractical in case of e.g. review bombing and moreover, the purpose of top 10 list is to recommend the most relevant movies.
My idea was to add relevance column into the movies table but I've got no clue how to count it:
- (amount of 5 star reviews * 5 ) + (amount of 4 star reviews * 4 ) and so on - no
- (amount of 5 star reviews * 1 ) + (amount of 4 star reviews * 0.8) + ... + (amount of 0 star reviews * 0.1) - no
- total amount of reviews / avgrating - no
- ((amount of 5 star reviews * 5 ) + (amount of 4 star reviews * 4 ) and so on) / amount of reviews total - mb, I'm not sure what about 0
Moreover, the rating in ratings is not a real number. User can give only 5, 4.5, 4 etc. score review. But what about the situation where users can rate movies like 5, 4.9, 4.8 ... 0.1?
So, how to perform this operation in better way?
[Upd] I think instead of division of smth. we should multiply averagerating
and reviews
from movies
in order to count the relevance (averagerating
and reviews
are alredy automatically updated on each insert/delete/update). Also we should try to normalize the product.
In this situation movies with 100 reviews of 5 and averagerating
of 5 won't beat up movies with averagerating
3.8 but with 57k reviews and also the problem of review bombing will be solved.
Can anyone prove my guess?