mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
perf: improve packages search-query
Improves performance for queries with large result sets. The "group by" clause can be removed for all search types but the keywords. Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
d8e91d058c
commit
7a9448a3e5
3 changed files with 33 additions and 17 deletions
|
@ -136,7 +136,10 @@ class PackageSearch:
|
|||
self._join_user()
|
||||
self._join_keywords()
|
||||
keywords = set(k.lower() for k in keywords)
|
||||
self.query = self.query.filter(PackageKeyword.Keyword.in_(keywords))
|
||||
self.query = self.query.filter(PackageKeyword.Keyword.in_(keywords)).group_by(
|
||||
models.Package.Name
|
||||
)
|
||||
|
||||
return self
|
||||
|
||||
def _search_by_maintainer(self, keywords: str) -> orm.Query:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue