Include ratings correctly in the search algorithm

Currently, the search algorithm prefers if a product has one 5 star rating (eventhough it displays No rating) over a product that has 4.9 stars and 100 ratings. This can be seen when sorting by ‘Rating’. And also in the default ‘Relevancy’ rating it doesn’t seem to be better to have many ratings. The problem is that users see much trash first and the products with many good ratings have a disadvantage.