bvbrc.keyword#

bvbrc.keyword(value: Any) RQLExpr#

Create an RQL keyword search expression.

This function creates a keyword search expression that performs text-based searching across searchable fields in the database. It’s useful for performing full-text or fuzzy searches when you don’t know the exact field to search in.

Parameters#

valueany

The search term or value to look for (typically a string). The search is case-insensitive and supports ‘*’ as a wildcard.

Returns#

RQL.RQLExpr

An RQL expression object representing the keyword search that can be used as a predicate in query construction.

Examples#

Simple keyword search:

>>> import bvbrc as bv
>>> q = bv.query(bv.keyword("tuberculosis"), limit=100)

Combine keyword search with other constraints:

>>> q = bv.query(
...     bv.keyword("antibiotic resistance"),
...     bv.fld("genome_status") == "Complete",
...     limit=50
... )

Multiple search terms:

>>> q = bv.query(
...     bv.keyword("SARS-CoV-2"),
...     select=["genome_id", "genome_name", "collection_date"],
...     sort=["-collection_date"]
... )