mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-13 20:29:56 +00:00
feat: filter out obvious duplicates from multisearch
This commit is contained in:
@ -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
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user