rating_scorer
The Problem: If you sort a View by rating, you've probably noticed something unfair: a product with 5 stars and 2 votes ranks higher than a product with 4.8 stars and 500 votes. The less-reviewed item gets top billing just because it has a perfect (but tiny) rating. This makes your "best products" list misleading, and it frustrates users.
The Solution: Rating Scorer automatically calculates fair scores using proven statistical math. Products are ranked based on both their rating and the number of votes, so well-reviewed items with consistently high ratings float to the top, not the products with just a few perfect reviews.
Install it, configure it through the field mapping wizard, and the ranking in your View becomes fair.
Features
- Bayesian Average Algorithm (default):
Prevents manipulation by low-volume reviews while fairly representing high-volume products - Other scoring methods:
Alternatively, Weighted or Wilson algorithms can be chosen instead - Configurable Scoring:
Administrators can adjust confidence thresholds and baseline ratings to suit their strategy - Field Type Integration:
Native Drupal field type ("Rating Score") for storing calculated scores - Block Display:
Pre-built block component for displaying a calculation widget to show stakeholders how the rating score is calculated - Fivestar Integration:
Works with the popular Fivestar module for a complete rating solution - Demo:
When enabling the demonstration sub-module, some example content with necessary fields is created, as well as a View that shows a fairly sorted list of that content
Post-Installation
- Configure Rating Scorer Settings:
- Navigate to
/admin/config/content/rating_scorer - Set your confidence threshold (default: 7 votes) - the number of votes before a product is considered "established"
- Set your average baseline rating (default: 3.5 stars) - used in Bayesian calculation for products with fewer votes
- Save configuration
- Navigate to
- Add Rating Score Field:
- Create or edit a content type at
/admin/structure/types - Add a new field of type "Rating Score"
- Configure field settings as needed, choosing the input fields for Rating and Number of Votes
- The module will automatically calculate and store the Bayesian Average rating score
- Create or edit a content type at
- Display Ratings or a Calculator:
- Option A - Field Formatter: Use the Rating Score field formatter on your content type to show it directly
- Option B - Views: Use the Rating Score field for sorting your voted items in a fair manner
- Option C - Block: Add the "Rating Scorer Calculator" block to your layout at
/admin/structure/blockto show stakeholders the fairness of their ranking
Additional Requirements
Required:
- Drupal Core 10 or higher (also compatible with Drupal 11)
Optional:
- Votingapi Module (drupal/votingapi) - handles voting and vote storage
- Fivestar Module (drupal/fivestar) - provides star rating UI and voting interface
System Requirements:
- No external APIs or third-party services required.
- Minimal performance impact. Calculation results are stored on form save.
Recommended Modules/Libraries
- Fivestar (drupal/fivestar): Provides a beautiful star rating widget for user voting directly on your site. Rating Scorer calculates fair scores; Fivestar provides the voting interface users interact with.
- Views (core module): Create custom displays and sorting by calculated rating scores instead of the direct rating average.
- Search API (drupal/search_api): Index Rating Scorer field values for advanced search and filtering.
- Block (core module): Display a calculation widget anywhere you want to showcase the fairness of the used algorithm.
Other Rating Systems:
- Generic comment ratings: Don't implement fairness algorithms
- Simple vote averaging: Vulnerable to manipulation by vote count
Rating Scorer's advantage: Solves the core problem of fair ranking considering the vote volume.
Why Choose Rating Scorer
- Only module (for now) implementing Bayesian Average algorithm for fair ranking of any entity in Drupal 10 upwards
- Zero external dependencies beyond Drupal core. Votingapi (Fivestar) is optional
- Actively maintained and Drupal 10/11 compatible
Getting Help
- Check the module's issue queue on Drupal.org
- Review the code examples in the demo sub-module
- Refer to any documentation in the docs folder of the module
AI usage
The module code was mainly generated by AI with human guidance, and reviewed, tested, and refined by the module maintainer. A demo was added, as well as extensive testing using that demo to ensure all code is working as expected, both in the published module and on any future versions.
The purpose of the module is also to showcase that a high-quality and useful module can be AI-created under the guidance of a maintainer with Drupal API knowledge.