mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(packages.search): fix default ordering & improve performance
- Use queries more closely aligned to PHP's implementation; removes the need for separate vote/notification queries. - Default sort by popularity Closes #214 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
e75aa386ea
commit
56bd60559c
7 changed files with 161 additions and 90 deletions
|
@ -200,7 +200,7 @@ def query_voted(query: List[models.Package],
|
|||
:return: Vote state dict (PackageBase.ID: int -> bool)
|
||||
"""
|
||||
output = defaultdict(bool)
|
||||
query_set = {pkg.PackageBase.ID for pkg in query}
|
||||
query_set = {pkg.PackageBaseID for pkg in query}
|
||||
voted = db.query(models.PackageVote).join(
|
||||
models.PackageBase,
|
||||
models.PackageBase.ID.in_(query_set)
|
||||
|
@ -223,7 +223,7 @@ def query_notified(query: List[models.Package],
|
|||
:return: Notification state dict (PackageBase.ID: int -> bool)
|
||||
"""
|
||||
output = defaultdict(bool)
|
||||
query_set = {pkg.PackageBase.ID for pkg in query}
|
||||
query_set = {pkg.PackageBaseID for pkg in query}
|
||||
notified = db.query(models.PackageNotification).join(
|
||||
models.PackageBase,
|
||||
models.PackageBase.ID.in_(query_set)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue