mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(rpc): fix performance of suggest[-pkgbase]
We were selecting the entire record; we should just select the Name column as done in this commit. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
61f3cb938c
commit
b7475a5bd0
1 changed files with 5 additions and 3 deletions
|
@ -213,7 +213,9 @@ class RPC:
|
|||
return []
|
||||
|
||||
arg = args[0]
|
||||
packages = db.query(models.Package).join(models.PackageBase).filter(
|
||||
packages = db.query(models.Package.Name).join(
|
||||
models.PackageBase
|
||||
).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.Package.Name.like(f"%{arg}%"))
|
||||
).order_by(models.Package.Name.asc()).limit(20)
|
||||
|
@ -223,11 +225,11 @@ class RPC:
|
|||
if not args:
|
||||
return []
|
||||
|
||||
records = db.query(models.PackageBase).filter(
|
||||
packages = db.query(models.PackageBase.Name).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.PackageBase.Name.like(f"%{args[0]}%"))
|
||||
).order_by(models.PackageBase.Name.asc()).limit(20)
|
||||
return [record.Name for record in records]
|
||||
return [pkg.Name for pkg in packages]
|
||||
|
||||
def handle(self, by: str = defaults.RPC_SEARCH_BY, args: List[str] = []):
|
||||
""" Request entrypoint. A router should pass v, type and args
|
||||
|
|
Loading…
Add table
Reference in a new issue