From fe5528dfb9e55fe00f9cece2e027702d94bcd291 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 4 Jul 2026 09:31:49 +0200 Subject: [PATCH] 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). --- lib/galaxy/tool_source_store/search.py | 7 +++++-- lib/galaxy/tools/search/__init__.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tool_source_store/search.py b/lib/galaxy/tool_source_store/search.py index fe028b6ebf5..bb95df3e5d6 100644 --- a/lib/galaxy/tool_source_store/search.py +++ b/lib/galaxy/tool_source_store/search.py @@ -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 [] diff --git a/lib/galaxy/tools/search/__init__.py b/lib/galaxy/tools/search/__init__.py index 53135bc9cdb..62e93eacd4b 100644 --- a/lib/galaxy/tools/search/__init__.py +++ b/lib/galaxy/tools/search/__init__.py @@ -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: