From e5a009a7774be1250cb9fb9732900afc29516f1f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 11 Apr 2017 14:55:20 -0400 Subject: [PATCH] Switch to using RepositorySearchScore table for search ranking Should make search queries much, much faster as it contains the denormalized RAC data --- data/model/repository.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/data/model/repository.py b/data/model/repository.py index ddaaa2e4b..f4a791552 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -471,9 +471,8 @@ def _get_sorted_matching_repositories(lookup_value, repo_kind='image', include_p query = (query .switch(Repository) - .join(RepositoryActionCount) - .where(RepositoryActionCount.date >= last_week) - .order_by(fn.Sum(RepositoryActionCount.count).desc())) + .join(RepositorySearchScore) + .order_by(RepositorySearchScore.score.desc())) return query