mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: /packages search result count
We need to query for this after we've applied all filters. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
bfd592299c
commit
dcaf407536
1 changed files with 6 additions and 6 deletions
|
@ -61,11 +61,6 @@ async def packages_get(request: Request, context: Dict[str, Any],
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
search.search_by(search_by, keyword)
|
search.search_by(search_by, keyword)
|
||||||
|
|
||||||
# Collect search result count here; we've applied our keywords.
|
|
||||||
# Including more query operations below, like ordering, will
|
|
||||||
# increase the amount of time required to collect a count.
|
|
||||||
num_packages = search.count()
|
|
||||||
|
|
||||||
flagged = request.query_params.get("outdated", None)
|
flagged = request.query_params.get("outdated", None)
|
||||||
if flagged:
|
if flagged:
|
||||||
# If outdated was given, set it up in the context.
|
# If outdated was given, set it up in the context.
|
||||||
|
@ -90,7 +85,12 @@ async def packages_get(request: Request, context: Dict[str, Any],
|
||||||
search.query = search.query.filter(
|
search.query = search.query.filter(
|
||||||
models.PackageBase.MaintainerUID.is_(None))
|
models.PackageBase.MaintainerUID.is_(None))
|
||||||
|
|
||||||
# Apply user-specified specified sort column and ordering.
|
# Collect search result count here; we've applied our keywords.
|
||||||
|
# Including more query operations below, like ordering, will
|
||||||
|
# increase the amount of time required to collect a count.
|
||||||
|
num_packages = search.count()
|
||||||
|
|
||||||
|
# Apply user-specified sort column and ordering.
|
||||||
search.sort_by(sort_by, sort_order)
|
search.sort_by(sort_by, sort_order)
|
||||||
|
|
||||||
# Insert search results into the context.
|
# Insert search results into the context.
|
||||||
|
|
Loading…
Add table
Reference in a new issue