mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
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:
@@ -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 []
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user