Tag search limit
This commit is contained in:
@@ -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}'."}]
|
||||
|
||||
Reference in New Issue
Block a user