Basic Usage
Query builder functions use the@@@
operator. @@@
takes a column on the left-hand side and a query builder function on the
right-hand side. It means “find all rows where the column matches the given query.”
For example:
Expected Output
Expected Output
description
matches the regex expression key.*rd
.
When to Use Query Builder Functions
For most use cases, we recommend using the full text search operators instead of query builder functions. However, there are two scenarios where query builder functions are useful. The first is if you need an advanced query type, like the regex query. The second is if you want to force query pushdown into the ParadeDB custom scan. In order for a query to be executed by ParadeDB, it must use at least one of the ParadeDB operators. However, there are some cases where queries that don’t contain a ParadeDB operator can be more efficiently executed by ParadeDB vs. standard Postgres. For example, when filtering on indexed columns using simple SQL conditions like ranges or null checks. In these scenarios, query builder functions provide ParadeDB-compatible equivalents of common SQL constructs, such as:pdb.range
is the equivalent of SQL range operators, i.e.<
,>
, etc.pdb.exists
is the equivalent ofIS NOT NULL
pdb.term
is the equivalent of=
for non-text fields and for text fields that use the keyword tokenizer