Verified Commit dcaf4075 authored by Kevin Morris's avatar Kevin Morris
Browse files

fix: /packages search result count



We need to query for this after we've applied all filters.

Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent bfd59229
......@@ -61,11 +61,6 @@ async def packages_get(request: Request, context: Dict[str, Any],
for keyword in keywords:
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)
if flagged:
# 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(
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)
# Insert search results into the context.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment