diff --git a/webapp/search/logic.py b/webapp/search/logic.py index 26d5b121e..8cb54013e 100644 --- a/webapp/search/logic.py +++ b/webapp/search/logic.py @@ -240,22 +240,16 @@ def filter_topics(topics): def search_charms(term: str, limit: int): - packages = app.store_api.find(term, fields=SEARCH_FIELDS) - charms = [ - package - for package in packages["results"] - if package["type"] == "charm" + packages = app.store_api.find(term, type="charm", fields=SEARCH_FIELDS)[ + "results" ] - return charms[:limit] + return packages[:limit] def search_bundles(term: str, limit: int): - packages = app.store_api.find(term, fields=SEARCH_FIELDS) - bundles = [ - package - for package in packages["results"] - if package["type"] == "bundle" + packages = app.store_api.find(term, type="bundle", fields=SEARCH_FIELDS)[ + "results" ] - return bundles[:limit] + return packages[:limit]