diff --git a/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_ByProjectType.sql b/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_ByProjectType.sql index ce5cb0c..7ed7076 100644 --- a/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_ByProjectType.sql +++ b/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_ByProjectType.sql @@ -1,4 +1,4 @@ -SELECT TOP(200) Dimension_Package.PackageId, SUM(DownloadCount) 'Downloads' +SELECT TOP(200) Dimension_Package.PackageId, SUM(CASE WHEN Dimension_Operation.Operation = 'Install' THEN DownloadCount ELSE (0.5 * DownloadCount) END) 'Downloads' FROM Fact_Download INNER JOIN Dimension_Package ON Dimension_Package.Id = Fact_Download.Dimension_Package_Id INNER JOIN Dimension_Date ON Dimension_Date.Id = Fact_Download.Dimension_Date_Id @@ -7,7 +7,7 @@ INNER JOIN Dimension_Project ON Dimension_Project.Id = Fact_Download.Dimension_P WHERE Dimension_Date.[Date] >= CONVERT(DATE, DATEADD(day, -42, GETDATE())) AND Dimension_Date.[Date] < CONVERT(DATE, GETDATE()) AND Dimension_Package.PackageListed = 1 - AND Dimension_Operation.Operation = 'Install' + AND (Dimension_Operation.Operation = 'Install' OR Dimension_Operation.Operation = 'Update') AND Dimension_Project.ProjectTypes = @ProjectGuid GROUP BY Dimension_Package.PackageId -ORDER BY SUM(DownloadCount) DESC +ORDER BY Downloads DESC diff --git a/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_Overall.sql b/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_Overall.sql index d439fd0..fc90775 100644 --- a/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_Overall.sql +++ b/src/NuGet.Services.Work/Jobs/Scripts/SearchRanking_Overall.sql @@ -1,4 +1,4 @@ -SELECT TOP(200) Dimension_Package.PackageId, SUM(DownloadCount) 'Downloads' +SELECT TOP(200) Dimension_Package.PackageId, SUM(CASE WHEN Dimension_Operation.Operation = 'Install' THEN DownloadCount ELSE (0.5 * DownloadCount) END) 'Downloads' FROM Fact_Download INNER JOIN Dimension_Package ON Dimension_Package.Id = Fact_Download.Dimension_Package_Id INNER JOIN Dimension_Date ON Dimension_Date.Id = Fact_Download.Dimension_Date_Id @@ -6,6 +6,6 @@ INNER JOIN Dimension_Operation ON Dimension_Operation.Id = Fact_Download.Dimensi WHERE Dimension_Date.[Date] >= CONVERT(DATE, DATEADD(day, -42, GETDATE())) AND Dimension_Date.[Date] < CONVERT(DATE, GETDATE()) AND Dimension_Package.PackageListed = 1 - AND Dimension_Operation.Operation = 'Install' + AND (Dimension_Operation.Operation = 'Install' OR Dimension_Operation.Operation = 'Update') GROUP BY Dimension_Package.PackageId -ORDER BY SUM(DownloadCount) DESC +ORDER BY Downloads DESC \ No newline at end of file