8º. Hybrid search with RRF: combining pgvector, tsvector, and a knowledge graph in one query
Here's a search query: "beach trip." Full-text search finds nothing — no record contains the word "beach." But there's a note that says "Qué calor en Valencia, el agua estaba perfecta." Semantic se...

Source: DEV Community
Here's a search query: "beach trip." Full-text search finds nothing — no record contains the word "beach." But there's a note that says "Qué calor en Valencia, el agua estaba perfecta." Semantic search finds it because the embedding for "beach trip" is close to the embedding for a hot day at the beach in Valencia. Now a different query: "Ana García." Semantic search returns a dozen vaguely related records. Full-text search returns the 3 records that literally contain "Ana García." But neither shows you that Ana attended last week's meeting, is CC'd on 5 email threads, and appears in tomorrow's calendar — connections that only the knowledge graph knows about. No single search method is enough. We needed all three, plus a way to combine them that doesn't require manual tuning. The four signals Our search pipeline produces four independent scores for every candidate result: Signal Source What it catches Tier Semantic pgvector cosine similarity Meaning-based matches ("beach" → "calor en Va