LazyToolboxSearch: search unlimited like the eager panel search

The lazy path capped whoosh results at tool_search_limit (default 20)
while eager ToolPanelViewSearch passes limit=None. Uniform-score matches
truncate in doc-insertion order, so a tag query fanning out to 23 tools
silently lost the last three (test_search_curated_tool_tags).
This commit is contained in:
mvdbeek
2026-07-28 17:27:24 +02:00
parent 428248677e
commit fe5528dfb9
2 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -238,10 +238,13 @@ class ToolWhooshIndex:
writer.delete_by_term("id", stale_id)
return written
def search(self, query: str, limit: int = 50) -> list[str]:
def search(self, query: str, limit: int | None = None) -> list[str]:
"""Return tool ids ranked for ``query`` (most-relevant first).
``limit`` matches the cap on the existing hand-rolled scorer.
``limit=None`` returns every match — the eager
``ToolPanelViewSearch`` searches unlimited, and capped results
truncate uniform-score hits arbitrarily (a tag query fanning out to
23 tools would silently lose the last 3 in doc-insertion order).
"""
if not query or not query.strip():
return []
+3 -1
View File
@@ -170,7 +170,9 @@ class LazyToolboxSearch(ToolBoxSearch):
if index_dir is None:
return []
searcher = ToolWhooshIndex(index_dir=index_dir, tuning=ToolSearchTuning.from_config(config))
return searcher.search(q, limit=int(config.tool_search_limit))
# limit=None matches ToolPanelViewSearch below, which searches
# unlimited — capping here would truncate uniform-score matches.
return searcher.search(q, limit=None)
class ToolPanelViewSearch: