From e46e668cc520e15113e1093a0163dcfb83a93f4a Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 21 Apr 2017 17:21:17 -0400 Subject: [PATCH] Fix search in postgres Stupid missing group_by again --- data/model/repository.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/model/repository.py b/data/model/repository.py index bf14dc97e..dcd624a3d 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -105,7 +105,7 @@ def purge_repository(namespace_name, repository_name): return False fetched.delete_instance(recursive=True, delete_nullable=False) - + # Run callbacks for callback in config.repo_cleanup_callbacks: callback(namespace_name, repository_name) @@ -279,8 +279,8 @@ def unstar_repository(user, repository): .execute()) except Star.DoesNotExist: raise DataModelException('Star not found.') - - + + def set_trust(repo, trust_enabled): repo.trust_enabled = trust_enabled repo.save() @@ -481,6 +481,7 @@ def _get_sorted_matching_repositories(lookup_value, repo_kind='image', include_p query = (query .switch(Repository) .join(RepositorySearchScore) + .group_by(Repository, Namespace, RepositorySearchScore) .order_by(RepositorySearchScore.score.desc())) return query