Tag search limit

This commit is contained in:
2026-07-27 01:45:52 -07:00
parent f0e5267828
commit c0c3a4c405
3 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -74,9 +74,9 @@ async def handle(args: Dict[str, Any]) -> List[Dict[str, Any]]:
# Sort by count descending
matches.sort(key=lambda x: x["count"], reverse=True)
# Format top 20 results
# Format top results
results = []
for m in matches[:20]:
for m in matches[:config.TAG_SEARCH_LIMIT]:
count_fmt = format_count(str(m["count"]))
type_sfx = get_type_suffix(m["type"])
@@ -90,7 +90,7 @@ async def handle(args: Dict[str, Any]) -> List[Dict[str, Any]]:
if not results:
# Attempt to find similar tags using difflib
all_names_lower = [t["name_lower"] for t in _TAG_CACHE]
suggestions_lower = difflib.get_close_matches(query, all_names_lower, n=10, cutoff=0.5)
suggestions_lower = difflib.get_close_matches(query, all_names_lower, n=config.TAG_SEARCH_LIMIT, cutoff=0.5)
if not suggestions_lower:
return [{"type": "text", "text": f"No tags found matching '{query}'."}]