Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.tools.search package

Module for building and searching the index of installed tools.

Before changing index-building or searching related parts it is highly recommended to read the docs at https://whoosh.readthedocs.io.

Schema - this is how we define the index, both for building and searching. A

field is created for each data element that we want to add e.g. tool name, tool ID, description. The type of field and its attributes define how entries for that field will be indexed and ultimately how they can be searched. Score weighting (boost) is added here on a per-field bases, to allow matches to important fields like “name” to receive a higher score.

Tokenizers - these take an attribute (e.g. name) and parse it into “tokens” to

be stored in the index. Can be done in many ways for different search functionality. For example, the IDTokenizer creates one token for an entire entry, resulting in an index field that requires a full-field match. The default tokenizer will break an entry into words, so that single word matches are possible.

Filters - various filters are available for processing content as the index is

built. A StopFilter removes common articles ‘a’, ‘for’, ‘and’ etc. A StemmingFilter removes suffixes from words to create a ‘base work’ e.g. stemming -> stem; opened -> open; philosophy -> philosoph.

galaxy.tools.search.get_or_create_index(index_dir, schema)[source]

Get or create a reference to the index.

class galaxy.tools.search.ToolBoxSearch(toolbox, index_dir: str, index_help: bool = True)[source]

Bases: object

Support searching across all fixed panel views in a toolbox.

Search is delegated off to ToolPanelViewSearch for each panel object.

__init__(toolbox, index_dir: str, index_help: bool = True)[source]
build_index(tool_cache, toolbox, index_help: bool = True) None[source]
search(*args, **kwd) List[str][source]
class galaxy.tools.search.ToolPanelViewSearch(panel_view_id: str, index_dir: str, config: GalaxyAppConfiguration, index_help: bool = True)[source]

Bases: object

Support searching tools in a toolbox. This implementation uses the Whoosh search library.

__init__(panel_view_id: str, index_dir: str, config: GalaxyAppConfiguration, index_help: bool = True)[source]

Build the schema and validate against the index.

build_index(tool_cache, toolbox, index_help: bool = True) None[source]

Prepare search index for tools loaded in toolbox.

Use tool_cache to determine which tools need indexing and which should be removed.

search(q: str, config: GalaxyAppConfiguration) List[str][source]

Perform search on the in-memory index.