Fuses semantic vector search with lexical full-text search using Reciprocal Rank Fusion in a PL/pgSQL RPC.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
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.