Trieve Search
Integrate Trieve Search with Fumadocs
This is a community maintained integration.
Introduction
The Trieve Integration automatically configures Trieve Search for site search.
By default, it creates a chunk for each paragraph in your document, it is officially recommended by Trieve.
Setup
Install Dependencies
Sign up on Trieve
Sign up and create a dataset. Then obtain 2 API keys where one has only read access and the other has admin access to create and delete chunks. Store these credentials in environment variables.
Notice
One API Key should have only read access for the public facing search and the other should have admin access to create and delete chunks.
Sync Dataset
You can export the search indexes from Next.js using a route handler:
Create a script, the sync
function will sync search indexes.
Make sure to run the script after build:
Workflow
You may manually sync with node ./update-index.mjs
, or
integrate it with your CI/CD pipeline.
Typescript Usage
You can use Bun or other JavaScript runtimes that supports TypeScript and ESM.
Search UI
On Fumadocs UI, you can use the SearchDialog
component:
-
Replace
apiKey
anddatasetId
with your desired values. -
Replace the default search dialog with your new component.
Search Client
Add the useTrieveSearch
hook:
Options
Tag Filter
To configure tag filtering, add a tag
value to indexes.
Search UI
Enable Tag Filter.
Search Client
The tag_set
field is an attribute for filtering. To filter indexes by tag, use the filter on Trieve search clients.
Or with useTrieveSearch
hook:
Last updated on