We build a working semantic search engine in about forty lines of Python. No vector database, no framework. Then we break it deliberately, because knowing where the naive version fails tells you which infrastructure you actually need.
What you'll learn:
Embedding a small knowledge base
Why "annual leave" matches "paid vacation" with no shared words
Query embedding, similarity scoring, ranking and top-K
A complete baseline implementation you can extend
Why brute-force search stops scaling
The failure where retrieval returns something confident and wrong
Engineer's Note: Start with a simple baseline before adding infrastructure.
Next: the specific reasons RAG retrieval fails.