@xpressai/docusaurus-vecto-search
v0.0.5
Published
Vecto search plugin for Docusaurus v2
Downloads
2
Readme
Docusaurus Vecto Search
Welcome to the Docusaurus Vecto Search repository! This plugin will provide a Vecto powered search for your Docusaurus website.
Setup
1) Install Plugin
Navigate to the root of your Docusaurus project, then install via
npm install @xpressai/docusaurus-vecto-search
2) Configuration
In your docusaurus.config.js
file, add the following to the themes
array:
themes: [
[
"docusaurus-vecto-search",
/** type {import("docusaurus-vecto-search").PluginOptions} */
({
vecto_public_token: "",
vector_space_id: 123,
top_k: 15
}),
],
]
Alternatively, you can also set your config to fetch Vecto vars from your ENV using process.env
, ie vecto_public_token = process.env.vecto_public_token
.
For the token, sign up for your access here.
3) Add Vecto User Token To Environment Variables
You'll need to set the VECTO_USER_TOKEN
environment variable for the docusaurus-vecto-search
plugin to function properly. This token is private and is not exposed during the Docusaurus build process as it is not added in the docusaurus config.
For CI/CD (e.g., GitHub Actions)
If you are deploying your Docusaurus site using a CI/CD service like GitHub Actions, set VECTO_USER_TOKEN
as an environment variable in your workflow configuration. You can use repository secrets to securely store the token.
For Local Development
For local development, you can export the VECTO_USER_TOKEN
in your terminal:
export VECTO_USER_TOKEN=your_token_value_here
Make sure to replace your_token_value_here with your actual Vecto user token.
Alternatively, you can create a .env
file in the root of your Docusaurus project and add the token there:
VECTO_USER_TOKEN=your_token_value_here
Using a .env file ensures that the token remains set between terminal sessions. Make sure to replace your_token_value_here with your actual Vecto user token.
4) Build!
Finally, build your Docusaurus website with the new search configuration:
yarn build
That's it! Your Docusaurus website should now be set up with the docusaurus-vecto-search
functionality.
Local Plugin Development
If you would like to modify the current Vecto Search plugin, here are the steps:
Clone and install the repository:
git clone https://github.com/XpressAI/docusaurus-vecto-search cd docusaurus-vecto-search yarn install
Create a symbolic link for the project:
yarn link
In a different directory, create a new Docusaurus website (ensure you're using version 2.4.3 or newer).
yarn create docusaurus my-website
You can also use an existing Docusaurus project, but ensure it's a recent version.
Move into the Docusaurus project directory and install its dependencies:
cd my-website yarn install
Link the previously linked
docusaurus-vecto-search
to this Docusaurus project:yarn link docusaurus-vecto-search
Build the Docusaurus project:
yarn build
Special Thanks
Forked from Docusaurus Search Local.