a6f05ab2d5
- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd) - Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py) - Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks - Fix .gitignore to track tools/ and .githooks/ - Fix git remote URL (remove plaintext token) - New wiki pages: 504 pages, 34 raw sources
3.3 KiB
3.3 KiB
categories, tags, created, source, type, aliases
| categories | tags | created | source | type | aliases | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
2026-04-07 | llm-wiki | tool |
|
qmd
qmd 是一个本地 Markdown 文件搜索引擎,支持混合 BM25/向量搜索和 LLM 重排序,适用于 LLM Wiki 规模增长后的搜索需求。
基本信息
| 属性 | 值 |
|---|---|
| 仓库 | github.com/tobi/qmd |
| 版本 | v2.1.0 |
| 类型 | 本地搜索引擎 |
| 支持格式 | Markdown |
| 搜索方式 | BM25 + 向量搜索混合 |
| 排序 | LLM 重排序 |
| 运行方式 | 全设备端(on-device) |
| GPU 加速 | Vulkan (Intel Iris Xe Graphics) |
当前配置
索引状态
| 指标 | 值 |
|---|---|
| 索引数据库 | C:\tmp\.cache\qmd\index.sqlite (26.2 MB) |
| 已索引文件 | 670 |
| 向量数 | 3060(全部嵌入完成) |
| 待嵌入 | 0 |
Collections
| 名称 | 路径 | 文件数 | 说明 |
|---|---|---|---|
wiki |
wiki/**/*.md |
391 | LLM Wiki 知识库 |
raw |
raw/**/*.md |
279 | 原始来源文档 |
模型
| 模型 | 用途 | 大小 |
|---|---|---|
| embeddinggemma-300M-Q8_0 | 文本嵌入(768维) | 329 MB |
| Qwen3-Reranker-0.6B-Q8_0 | LLM 重排序 | — |
| qmd-query-expansion-1.7B | 查询扩展 | 1.28 GB |
搜索模式
BM25 全文搜索
qmd search "人工智能教育" -c wiki --limit 5
- 基于 SQLite FTS5
- 支持中英文搜索
- 速度快,适合精确关键词匹配
向量搜索
qmd vsearch "AI个性化学习" -c wiki --limit 5
- 基于 embeddinggemma 嵌入模型
- 自动进行查询扩展(query expansion)
- 支持语义相似度匹配
混合搜索
qmd query "人工智能教育发展趋势" -c wiki
- 结合 BM25 + 向量搜索 + LLM 重排序
- 效果最佳但速度较慢
Windows 特殊说明
运行方式
qmd CLI 脚本引用 /bin/sh,在 Windows 上不能直接运行 qmd 命令。使用以下方式之一:
# 方式1:通过 node 直接运行(推荐)
node "C:\Users\hhhh2024\AppData\Roaming\npm\node_modules\@tobilu\qmd\dist\cli\qmd.js" <command>
# 方式2:使用包装脚本
D:\Applications\app\kepano-obsidian-main\tools\scripts\qmd.cmd <command>
嵌入注意事项
qmd embed在 Intel Iris Xe 上较慢,670文件约需10-15分钟- 如果超时,可多次运行,会自动续传
- 使用
qmd embed -f强制重新嵌入(更换模型后需要)
接口
| 接口 | 用途 |
|---|---|
| CLI | LLM 可以通过 shell 调用 |
| MCP Server | qmd mcp 启动 MCP 服务器,LLM 作为原生工具使用 |
常用命令
# 查看状态
qmd status
# 重新嵌入(新增文件后)
qmd embed
# 更新 collection(新增文件到索引)
qmd add wiki --pattern "wiki/**/*.md"
# 搜索
qmd search "关键词" -c wiki
qmd vsearch "语义查询" -c wiki
qmd query "综合查询" -c wiki
在 LLM Wiki 中的角色
- 小规模时:index 文件足够导航
- 增长后:qmd 提供正式搜索能力
- 作为 MCP Server 可被 LLM Agent 直接调用,无需手动搜索
- 当前已完整配置:670文件、3060向量、BM25+向量搜索均可使用