Create Example Table
ParadeDB comes with a helpful procedure that creates a table populated with mock data to help you get started. Once connected withpsql, run the following commands to create and inspect
this table.
Expected Response
Expected Response
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 wheredescription matches running shoes where rating is greater than 2.
Expected Response
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
Expected Response
BM25 Scoring
Next, let’s add BM25 scoring to the results, which allows us to sort matches by relevance. To do this, we’ll usepdb.score.
Expected Response
Expected Response
Highlighting
Finally, let’s also highlight the relevant portions of the documents that were matched. To do this, we’ll usepdb.snippet.
Expected Response
Expected Response