Fuses semantic vector search with lexical full-text search using Reciprocal Rank Fusion in a PL/pgSQL RPC.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Fuses semantic vector search with lexical full-text search using Reciprocal Rank Fusion in a PL/pgSQL RPC.
This tile produces a single PL/pgSQL RPC that combines pgvector cosine-distance results with PostgreSQL tsvector full-text results. Reciprocal Rank Fusion (RRF) merges the two ranked lists into one unified score using the formula score = 1/(k + rank), where k defaults to 60. The fused score surfaces rows that rank well in either or both retrieval methods.
semantic_score = 1.0 / (k + semantic_rank)
fulltext_score = 1.0 / (k + fulltext_rank)
combined_score = semantic_score + fulltext_score| Extension | Purpose |
|---|---|
vector | pgvector cosine similarity |
| Type | Column | Index Kind |
|---|---|---|
| Vector | embedding | HNSW |
| Text | fts | GIN |
hybrid_search(
query_embedding vector,
query_text text,
match_count int DEFAULT 20,
k int DEFAULT 60
) RETURNS TABLE (id, combined_score, semantic_score, fulltext_score)This tile executes after pgvector-hnsw-index-selection has confirmed the HNSW index exists. It produces a callable RPC that downstream tiles or application code invoke for search. It does not manage index creation itself.