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
|
@ -740,6 +740,23 @@ def test_packages_search_by_keywords(client: TestClient, packages: list[Package]
|
|||
rows = root.xpath('//table[@class="results"]/tbody/tr')
|
||||
assert len(rows) == 1
|
||||
|
||||
# Now let's add another keyword to the same package
|
||||
with db.begin():
|
||||
db.create(
|
||||
PackageKeyword, PackageBase=package.PackageBase, Keyword="testKeyword2"
|
||||
)
|
||||
|
||||
# And request packages with both keywords, we should still get 1 result.
|
||||
with client as request:
|
||||
response = request.get(
|
||||
"/packages", params={"SeB": "k", "K": "testKeyword testKeyword2"}
|
||||
)
|
||||
assert response.status_code == int(HTTPStatus.OK)
|
||||
|
||||
root = parse_root(response.text)
|
||||
rows = root.xpath('//table[@class="results"]/tbody/tr')
|
||||
assert len(rows) == 1
|
||||
|
||||
|
||||
def test_packages_search_by_maintainer(
|
||||
client: TestClient, maintainer: User, package: Package
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue