postgres-hybrid-text-search
兼顾精确关键词与语义相关性,适合文档与知识库检索优化。
依赖外部 embedding 模型与数据库扩展,成本与兼容性需评估
用 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.
帮我安装这个 skill:https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/postgres-hybrid-text-search/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/timescale/pg-aiguide/main/skills/postgres-hybrid-text-search/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