Building AI-Powered Search with Embeddings
A deep dive into building semantic search from scratch — vector embeddings, cosine similarity, and why keyword search falls short for complex queries.
In this episode, we go deep on semantic search: what it is, why it beats keyword matching for complex queries, and how to build it yourself using open-source embedding models.
Topics Covered
- What are vector embeddings and why they matter
- Cosine similarity explained intuitively
- Choosing an embedding model (OpenAI vs open-source)
- Storing and querying vectors with pgvector
- A live walkthrough of the search feature I shipped last month
Resources Mentioned
- pgvector on GitHub
- Sentence Transformers
- My project: Personal Knowledge Base (see Projects page)
Show Notes
The idea for this episode came from a question a listener sent in: "Why does my search feel so dumb?" Great question. Traditional full-text search works well when users know exactly what keywords to use. But in practice, people search the way they think, not the way databases index.
Semantic search closes that gap by representing meaning as numbers (vectors) and finding results that are conceptually close, not just lexically similar. The math sounds intimidating but the intuition is simple: words and sentences that mean similar things end up close together in high-dimensional space.