Skip to main content
This guide will walk you through a few queries to give you a feel for ParadeDB.

Create Example Table

ParadeDB comes with a helpful procedure that creates a table populated with mock data to help you get started. Once connected with psql, run the following commands to create and inspect this table.
Expected Response
Next, let’s create a BM25 index called search_idx on this table. A BM25 index is a covering index, which means that multiple columns can be included in the same index.
As a general rule of thumb, any columns that you want to filter, GROUP BY, ORDER BY, or aggregate as part of a full text query should be added to the index for faster performance.
Note the mandatory key_field option. See choosing a key field for more details.

Match Query

We’re now ready to execute a basic text search query. We’ll look for matches where description matches running shoes where rating is greater than 2.
Expected Response
||| is ParadeDB’s custom match disjunction operator, which means “find me all documents containing running OR shoes. If we want all documents containing running AND shoes, we can use ParadeDB’s &&& match conjunction operator.
Expected Response

BM25 Scoring

Next, let’s add BM25 scoring to the results, which sorts matches by relevance. To do this, we’ll use pdb.score.
Expected Response

Highlighting

Finally, let’s also highlight the relevant portions of the documents that were matched. To do this, we’ll use pdb.snippet.
Expected Response

Top N

ParadeDB is highly optimized for quickly returning the Top N results out of the index. In SQL, this means queries that contain an ORDER BY...LIMIT:
Expected Response

Facets

Faceted queries allow a single query to return both the Top N results and an aggregate value, which is more CPU-efficient than issuing two separate queries. For example, the following query returns the top 3 results as well as the total number of results matched.
Expected Response
That’s it! Next, let’s load your data to start running real queries.