Files
nexus/wiki/concepts/混合搜索.md
2026-04-18 00:18:08 +08:00

32 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "混合搜索"
type: concept
tags: [ai-agent, search, rag]
last_updated: 2026-04-02
---
## Definition
结合 BM25关键词匹配、向量嵌入语义相似性和重排序器的搜索策略。
## Components
1. **BM25**:关键词匹配,擅长精确短语和专有名词
2. **向量嵌入**:语义相似性,擅长理解查询意图
3. **重排序器**:按相关性排序结果
## Problem Solved
纯语义搜索在专有名词、具体数字和确切短语上失败。关键词搜索抓住它们。两者都用效果更好。
## Comparison
| 搜索方式 | 优点 | 缺点 |
|---------|------|------|
| 纯向量搜索 | 语义理解 | 精确匹配差 |
| 纯 BM25 | 精确匹配 | 无法理解同义词 |
| 混合搜索 | 结合两者优势 | 实现更复杂 |
## Implementation
切换到 QMD 作为内存搜索后端,实现混合搜索策略。
## Related
- [[语义搜索]] — 纯向量搜索
- [[向量嵌入]] — 将文本转换为数值向量
- [[上下文记忆]] — AI Agent 保留对话历史的能力