Hybrid retrieval with PostgreSQL and pgvector
A database-side recipe that combines PostgreSQL text search with vector similarity using rank fusion.
Published by Supabase
How to use it
Create both a text-search representation and an embedding field for each passage. Retrieve separate candidate lists with lexical and semantic search and merge their rankings with reciprocal rank fusion.
Try queries containing both a product name and a paraphrased question. Record the text-only, vector-only, and combined rankings to check where each route helps.
- Compatibility
- PostgreSQL, pgvector, SQL
- Components
- Hybrid retrieval, PostgreSQL full-text search, Reciprocal rank fusion
- Access
- SQL recipe for PostgreSQL with pgvector. Embeddings are supplied separately.
