Mixedbread
将 Mixedbread 搜索与 Fumadocs 集成
介绍
🌐 Introduction
Mixedbread 集成使用向量搜索为你的文档提供语义搜索功能。它将你的文档内容编入索引存储,使用户能够使用自然语言查询进行搜索,并基于意义而不仅仅是关键词匹配来找到相关内容。
🌐 The Mixedbread Integration uses vector search to provide semantic search capabilities for your documentation. It indexes your documentation content into a store, enabling users to search using natural language queries and find relevant content based on meaning rather than just keyword matching.
安装
🌐 Setup
获取你的 API 密钥
🌐 Get your API Key
- 在 Mixedbread 注册
- 导航到 API 密钥
- 创建一个新的 API 密钥并将其存储在你的环境变量中
创建商店
🌐 Create a Store
要同步你的文档,你需要创建一个存储:
🌐 To sync your documentation, you'll need to create a store:
- 前往你的 Mixedbread 仪表板中的商店
- 为你的文档创建一个新商店
- 复制商店ID
同步文档
🌐 Sync Documentation
使用 Mixedbread CLI 来同步你的文档:
🌐 Use the Mixedbread CLI to sync your documentation:
安装 CLI:
🌐 Install the CLI:
npm install @mixedbread/cli -D配置身份验证并同步你的文档:
🌐 Configure authentication and sync your documentation:
# Configure authentication
mxbai config keys add YOUR_API_KEY
# Sync your documentation
mxbai vs sync YOUR_STORE_ID "./content/docs"CLI 将自动检测文档中的更改,并相应地更新商店。
🌐 The CLI will automatically detect changes in your documentation and update the store accordingly.
工作流程
🌐 Workflow
你可以通过将同步脚本添加到你的 package.json 来自动同步你的文档:
🌐 You can automatically sync your documentation by adding a sync script to your package.json:
{
"scripts": {
"build": "... && mxbai vs sync YOUR_STORE_ID './content/docs' --ci"
}
}搜索客户
🌐 Search Client
-
Fumadocs 用户界面:详情请参见 搜索界面。
-
搜索客户端:
import { useDocsSearch } from 'fumadocs-core/search/client'; const mxbai = new Mixedbread({ apiKey: 'YOUR_API_KEY', }); const client = useDocsSearch({ type: 'mixedbread', client: mxbai, });
选项
🌐 Options
标签过滤
🌐 Tag Filter
要按标签筛选搜索结果,请在文档元数据中添加标签字段:
🌐 To filter search results by tags, add a tag field to your document metadata:
---
title: Mixedbread
description: Integrate Mixedbread Search with Fumadocs
url: /docs/headless/search/mixedbread
tag: docs
---并更新你的搜索客户端:
🌐 And update your search client:
-
Fumadocs 界面:在搜索界面启用 标签筛选。
-
搜索客户端:你可以像这样添加标签过滤器:
import { useDocsSearch } from 'fumadocs-core/search/client'; const { search, setSearch, query } = useDocsSearch({ tag: '<your tag value>', // ... });
这使你可以将搜索范围限制在文档的特定部分。
🌐 This allows you to scope searches to specific sections of your documentation.
Last updated on
