mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(rpc): provides search should return name match
We need to return packages matching on the name as well. (A package always provides itself) Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
2b8dedb3a2
commit
d8e91d058c
2 changed files with 24 additions and 1 deletions
|
@ -376,8 +376,18 @@ class RPC:
|
|||
search.search_by(by, arg)
|
||||
|
||||
max_results = config.getint("options", "max_rpc_results")
|
||||
results = self.entities(search.results()).limit(max_results + 1).all()
|
||||
|
||||
query = self.entities(search.results()).limit(max_results + 1)
|
||||
|
||||
# For "provides", we need to union our relation search
|
||||
# with an exact search since a package always provides itself.
|
||||
# Turns out that doing this with an OR statement is extremely slow
|
||||
if by == "provides":
|
||||
search = RPCSearch()
|
||||
search._search_by_exact_name(arg)
|
||||
query = query.union(self.entities(search.results()))
|
||||
|
||||
results = query.all()
|
||||
if len(results) > max_results:
|
||||
raise RPCError("Too many package results.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue