Retrieval ranking orders search results by relevance; a rank is an item’s ordinal position in that list. Keyword and vector searches produce scores on different scales, so combining their scores directly can be unreliable. section 5.5.3
Reciprocal Rank Fusion (RRF) combines ranked lists using position rather than score: each result receives 1/(k + rank) per list, with k=60 a standard default. Results ranked highly by both searches rise in the combined list. For keyword retrieval, PostgreSQL full-text search offers a practical starting point; its ts_rank is simpler than BM25 because it does not account for corpus-wide term rarity. section 5.5.2 section 5.5.3
Listing 5.22 Adding full-text search to the chunks table
ALTER TABLE chunks
ADD COLUMN search_vector tsvector
GENERATED ALWAYS AS (
to_tsvector('english', chunk_text)
) STORED; #A
CREATE INDEX idx_chunks_search
ON chunks USING gin (search_vector); #BA generated tsvector and GIN index provide a PostgreSQL keyword-search path for ranking results. section 5.5.2








