title: 'Full-Text Search' sidebar_label: 'Full-text Search' description: 'Learn how Spice can perform full text search' sidebar_position: 2 tags:
Spice provides full text search functionality with BM25 scoring. Datasets can be augmented with a full-text search index that enables efficient search. Dataset columns are included in the full-text index based on the column configuration.
To enable full-text search, configure your dataset columns within your dataset definition as follows:
In this example, full-text search indexing is enabled on both the title and body columns. The row_id specifies a unique identifier for referencing search results and retrieving additional data.
After enabling indexing, you can perform searches using the HTTP API endpoint /v1/search. Results will be ranked based on the relevance to your keyword query across indexed columns (title and body in this example).
For details on using this endpoint, see the [API reference for /v1/search(../../api/HTTP/post-search).
Spice also provides full-text search through SQL using a user-defined table function (UDTF), text_search().
Here's how you can query using SQL:
This returns the top 5 results from the doc.pulls dataset that best match your search keywords within the body column.
The text_search() function has the following signature:
By default, text_search retrieves up to 1000 results. To adjust this, specify the limit parameter in the function call.
Use this function to integrate robust full-text search directly into your data workflows with minimal setup.