feat: filter out obvious duplicates from multisearch

This commit is contained in:
2025-07-01 09:59:29 +03:00
parent b729096a25
commit fdc27a9ebf
3 changed files with 22 additions and 1 deletions

View File

@ -94,6 +94,15 @@ class Remote(SyncHttpClient):
for package in portion
if package.name in packages or not packages
}
# simple check for duplicates. This method will remove all packages under base if there is
# a package named exactly as its base
packages = {
package.name: package
for package in packages.values()
if package.package_base not in packages or package.package_base == package.name
}
return list(packages.values())
@classmethod

View File

@ -70,7 +70,7 @@ class SearchView(BaseView):
if not packages:
raise HTTPNotFound(reason=f"No packages found for terms: {search}")
comparator: Callable[[AURPackage], str] = lambda item: str(item.package_base)
comparator: Callable[[AURPackage], str] = lambda item: item.package_base
response = [
{
"package": package.package_base,