mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(rpc): suggestions should only suggest based on <keyword>%
Previously, Python code was looking for suggestions based on `%<keyword>%`. This was inconsistent with PHP's suggestion implementation and cause more records to be bundled with a suggestion, along with supplying misleading suggestions. Closes #343 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
9791704632
commit
a1a88ea872
2 changed files with 19 additions and 2 deletions
|
@ -332,7 +332,7 @@ class RPC:
|
|||
models.PackageBase
|
||||
).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.Package.Name.like(f"%{arg}%"))
|
||||
models.Package.Name.like(f"{arg}%"))
|
||||
).order_by(models.Package.Name.asc()).limit(20)
|
||||
return [pkg.Name for pkg in packages]
|
||||
|
||||
|
@ -341,9 +341,10 @@ class RPC:
|
|||
if not args:
|
||||
return []
|
||||
|
||||
arg = args[0]
|
||||
packages = db.query(models.PackageBase.Name).filter(
|
||||
and_(models.PackageBase.PackagerUID.isnot(None),
|
||||
models.PackageBase.Name.like(f"%{args[0]}%"))
|
||||
models.PackageBase.Name.like(f"{arg}%"))
|
||||
).order_by(models.PackageBase.Name.asc()).limit(20)
|
||||
return [pkg.Name for pkg in packages]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue