怎么做混合检索How to Do Hybrid Search
微型指南 · 约 7 分钟Guide · about 7 min · 引用核验 2026-11-03(仅引用链接与日期) · refs checked 2026-11-03 (reference links and dates only)
向量检索擅长意思相近,关键词检索擅长精确匹配。混合检索把两条路的结果合起来。Vector search is good at similar meaning; keyword search is good at exact matches. Hybrid search merges the results of both paths.
型号、编号等精确条件可用关键词或结构化过滤;同时检查分词、拼写与索引字段,关键词检索也可能漏掉结果。
模糊问法交给向量:换个说法也能命中,这是关键词做不到的。
两路结果要融合:常用倒数排名融合(RRF),按名次合并而不是按分数硬加。
分数不可直接相加:向量相似度和 BM25 分数量纲不同,硬加会偏。
看数据库是否原生支持:混合查询在 Qdrant、Weaviate 里是现成功能。
融合后是否重排取决于质量和延迟预算;先量候选召回与排序,避免默认增加一层模型。
Use keyword search or structured filters for exact model/ID conditions, while checking tokenization, spelling and indexed fields; keyword retrieval can also miss results.
Give fuzzy phrasing to vectors: a reworded question still hits, which keywords cannot do.
Fuse the two result lists: reciprocal rank fusion (RRF) merges by rank, not by force-adding scores.
Scores cannot be added directly: cosine similarity and BM25 scores have different scales; adding them skews results.
Check native support: hybrid queries are built into Qdrant and Weaviate.
Decide about reranking after fusion from quality and latency needs. Measure candidate recall and ranking instead of adding another model by default.
例子与判断Example and interpretation
以下是教学情境,不是本站运行或实测记录。A teaching scenario, not a measured or executed site test.
用户输入“XJ-204 电机过热怎么办”。型号需要精确命中,故障描述又可能写成“温升异常”。分别检查关键词和向量两路是否找到维修页,再检查融合结果,不预设混合一定比单路更好。In “XJ-204 motor overheating,” the model number needs an exact match while the fault may be described differently. Inspect keyword and vector candidates, then fusion. Do not assume hybrid search always wins.
联网 / 检索增强Retrieval-Augmented Generation, RAG 向量数据库Vector Database 分块Chunking