If your RAG runs on Postgres + pgvector, you have probably added full-text search next to vector search, because every production write-up says pure vector search misses exact identifiers: error codes, SKUs, version strings, product names.
Anthropic's own example is a user searching for "Error code TS-999": embeddings find content about error codes in general, while keyword search finds the exact match (Contextual Retrieval).
So you write this:
sql SELECT * FROM chunks WHERE tsv @@ websearch_to_tsquery ( 'english' , : question ) ORDER BY ts_rank_cd ( tsv , websearch_to_tsquery ( 'english' , : question )) DESC LIMIT 50 ;
Enter fullscreen mode
Exit fullscreen mode
It looks right. It passes your test query. And for most real questions it returns nothing.
Why
websearch_to_tsquery joins every word with AND. A user asks "how many requests per minute does the growth plan allow?".…