diff --git a/src/NzbDrone.Core/Movies/MovieRepository.cs b/src/NzbDrone.Core/Movies/MovieRepository.cs index 1867da7cc..3e6f4b7eb 100644 --- a/src/NzbDrone.Core/Movies/MovieRepository.cs +++ b/src/NzbDrone.Core/Movies/MovieRepository.cs @@ -322,11 +322,21 @@ namespace NzbDrone.Core.Movies using (var conn = _database.OpenConnection()) { - recommendations = conn.Query(@" - SELECT Rec FROM - (SELECT CAST(j.value AS INT) AS Rec FROM Movies CROSS JOIN json_each(Movies.Recommendations) AS j - WHERE Rec NOT IN (SELECT TmdbId FROM Movies union SELECT TmdbId from ImportExclusions)) - GROUP BY Rec ORDER BY count(*) DESC LIMIT 100;").ToList(); + recommendations = conn.Query(@"SELECT DISTINCT Rec FROM ( + SELECT DISTINCT Rec FROM + ( + SELECT DISTINCT CAST(j.value AS INT) AS Rec FROM Movies CROSS JOIN json_each(Movies.Recommendations) AS j + WHERE Rec NOT IN (SELECT TmdbId FROM Movies union SELECT TmdbId from ImportExclusions) LIMIT 10 + ) + UNION + SELECT Rec FROM + ( + SELECT CAST(j.value AS INT) AS Rec FROM Movies CROSS JOIN json_each(Movies.Recommendations) AS j + WHERE Rec NOT IN (SELECT TmdbId FROM Movies union SELECT TmdbId from ImportExclusions) + GROUP BY Rec ORDER BY count(*) DESC LIMIT 120 + ) + ) + LIMIT 100;").ToList(); } return recommendations;