Switch to using RepositorySearchScore table for search ranking

Should make search queries much, much faster as it contains the denormalized RAC data
This commit is contained in:
Joseph Schorr 2017-04-11 14:55:20 -04:00
parent 9d781b25e5
commit e5a009a777

View file

@ -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