# Top Rated

## Route

- URL: `GET /discover/top-rated`
- Controller: `App\Http\Controllers\Web\DiscoverController::topRated()`
- Service: `App\Services\ArtworkSearchService::discoverTopRated()`

## What the page reads

This is a Meilisearch-ranked page with MySQL hydration after the fact.

## Search query

`discoverTopRated()` uses:

- filter: `is_public = true AND is_approved = true`
- sort:
  - `likes:desc`
  - `views:desc`

In the indexed document:

- `likes` is sourced from `artwork_stats.favorites`
- `views` is sourced from `artwork_stats.views`

So "Top Rated" really means highest favourite count, with views as a tie-breaker.

## Data sources

The page depends on:

- `artwork_stats.favorites`
- `artwork_stats.views`
- Scout/Meilisearch document freshness

It does not run a custom score formula beyond the sort order above.

## Background jobs and schedules

There is no dedicated top-rated cron.
The page depends on the freshness of the underlying stats.

Relevant active maintenance:

- `skinbase:flush-redis-stats` every 5 minutes for deferred stat deltas

Favorites themselves are typically updated in the normal request path rather than by a dedicated scheduled command.

## Cache behavior

- Cache key: `discover.top-rated.{page}`
- TTL: 300 seconds

## Notes

- Awards are not part of this page's ranking.
- If the business meaning should be "best overall" rather than "most favourited," this page would need a different sort field.