Vector search loses on names. Add keywords
An embedding of PAYMENTS_WEBHOOK_SECRET is close to the embedding of any other environment variable. Full text search finds the exact string. Run both, fuse the rankings.
SELECT id, sum(1.0 / (60 + r)) AS score
FROM (vector_ranked UNION ALL keyword_ranked) u
GROUP BY id ORDER BY score DESC LIMIT 20;On an internal docs corpus this took recall at 5 from 70 to 79 percent, and queries with a specific name in them from 50 to 90.
ragpostgresqlsearch
Longer version: the post this came from.