Milestone 5 polish

This commit is contained in:
2026-04-26 00:08:55 +02:00
parent 8d1e1ff583
commit e8fdfe6e17
6 changed files with 76 additions and 5 deletions

View File

@@ -1282,6 +1282,8 @@ class RegistryStore:
status: str | None = None,
language: str | None = None,
framework: str | None = None,
ability: str | None = None,
capability: str | None = None,
) -> list[SearchResult]:
term = query.strip()
needle = f"%{term}%"
@@ -1294,6 +1296,8 @@ class RegistryStore:
status=status,
language=language,
framework=framework,
ability=ability,
capability=capability,
)
if repository_ids is not None and not repository_ids:
return []
@@ -1502,6 +1506,8 @@ class RegistryStore:
status: str | None,
language: str | None,
framework: str | None,
ability: str | None,
capability: str | None,
) -> list[int] | None:
filters: list[set[int]] = []
if status:
@@ -1530,6 +1536,26 @@ class RegistryStore:
(framework,),
).fetchall()
filters.append({row["repository_id"] for row in rows})
if ability:
rows = connection.execute(
"""
SELECT DISTINCT repository_id
FROM approved_abilities
WHERE name LIKE ? OR description LIKE ?
""",
(f"%{ability}%", f"%{ability}%"),
).fetchall()
filters.append({row["repository_id"] for row in rows})
if capability:
rows = connection.execute(
"""
SELECT DISTINCT repository_id
FROM approved_capabilities
WHERE name LIKE ? OR description LIKE ?
""",
(f"%{capability}%", f"%{capability}%"),
).fetchall()
filters.append({row["repository_id"] for row in rows})
if not filters:
return None
repository_ids = set.intersection(*filters)