postgres-hybrid-text-search

仓库创建 2025年7月24日最近提交 1 个月前SkillHot 收录 20 天前
▸ 精选理由

兼顾精确关键词与语义相关性,适合文档与知识库检索优化。

▸ 风险提示

依赖外部 embedding 模型与数据库扩展,成本与兼容性需评估

这个 Skill 做什么

用 RRF 将 BM25 关键词检索与向量语义搜索融合成混合检索。

把传统的关键词检索(BM25)和向量语义检索(pgvector)合并,既能命中精确词条又能按语义找相关内容,最后用 RRF(Reciprocal Rank Fusion)把结果合并排序。适合需要同时兼顾精确匹配和语义召回的搜索场景。特别之处是可以对两个来源做加权融合和再排序,灵活调整权重以兼顾精确度和覆盖率。

▸ 展开 SKILL.md 英文原文

Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF). **Trigger when user asks to:** - Combine keyword and semantic search - Implement hybrid search or multi-modal retrieval - Use BM25/pg_textsearch with pgvector together - Implement RRF (Reciprocal Rank Fusion) for search - Build search that handles both exact terms and meaning **Keywords:** hybrid search, BM25, pg_textsearch, RRF, reciprocal rank fusion, keyword search, full-text search, reranking, cross-encoder Covers: pg_textsearch BM25 index setup, parallel query patterns, client-side RRF fusion (Python/TypeScript), weighting strategies, and optional ML reranking.

数据与抓取混合检索BM25向量融合通用
1.8k
Stars
99
Forks
10
仓库内 Skill
+13
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/postgres-hybrid-text-search/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/postgres-hybrid-text-search/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Hybrid Text Search

Hybrid search combines keyword search (BM25) with semantic search (vector embeddings) to get the best of both: exact keyword matching and meaning-based retrieval. Use Reciprocal Rank Fusion (RRF) to merge results from both methods into a single ranked list.

This guide covers combining [pg_textsearch](https://github.com/timescale/pg_textsearch) (BM25) with [pgvector](https://github.com/pgvector/pgvector). Requires both extensions. For high-volume setups, filtering, or advanced pgvector tuning (binary quantization, HNSW parameters), see the **pgvector-semantic-search** skill.

pg_textsearch is a new BM25 text search extension for PostgreSQL, fully open-source and availab
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有