Vector search loses on names. Add keywords
The embedding of PAYMENTS_WEBHOOK_SECRET sits close to the embedding of any other environment variable. Full text search finds the exact string. Run both and 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 from 50 to 90 for queries with a specific name in them.
ragpostgresqlsearch
Longer version: the post this came from.