8. Vector Search#
Keyword search finds words; vector search finds meaning. This chapter explains how embeddings turn text into vectors, how vector stores index them, and how to measure whether a search system returns the right results.
Embeddings: Embedding models turn text into vectors so similar meanings sit close together.
Vector Stores: Vector indexes and metadata filters make similarity search fast at scale.
Search Quality: Recall, precision, and hybrid search show whether results are good enough.
Chapter Video
This short explainer shows how embeddings turn content into vectors and how a vector index finds similar items by meaning.
Vector Databases simply explained! (Embeddings & Indexes) (4:23) by AssemblyAI
Hosted on YouTube; property of its original creator, embedded here for educational reference only.
Learning Objectives
By the end of this chapter, you will be able to:
Explain how embeddings represent meaning as vectors.
Compute cosine similarity between text embeddings.
Describe how vector stores index embeddings and filter by metadata.
Measure search quality with precision and recall at k.
Build semantic search over knowledge base articles in Python.
Chapter Flow
Glossary
# |
Term |
Explanation |
|---|---|---|
1 |
Vector |
An ordered list of numbers. |
2 |
Embedding model |
A model that converts text into vectors. |
3 |
Semantic search |
Search that matches meaning rather than exact words. |
4 |
Cosine similarity |
A measure of how closely two vectors point in the same direction. |
5 |
Vector store |
A database designed to store vectors and search them by similarity. |
6 |
Vector index |
A data structure that speeds up similarity search. |
7 |
Approximate nearest neighbor (ANN) |
Search that finds close matches quickly by accepting small errors. |
8 |
Metadata filter |
A condition on fields such as date or department that narrows a vector search. |
9 |
Keyword search |
Search that matches the exact words in a query. |
10 |
Hybrid search |
Search that combines keyword and vector results. |
11 |
Precision at k |
The share of the top k results that are relevant. |
12 |
Recall at k |
The share of all relevant items that appear in the top k results. |
13 |
Unit vector |
A vector with length one. |
14 |
Zero vector |
A vector with no defined cosine direction. |
15 |
Top-k |
A limit on the number of ranked results. |
16 |
Relevance judgment |
A reviewed assessment of whether a record meets a query need. |
17 |
ANN recall |
Agreement of approximate results with eligible exact neighbors. |
18 |
Tombstone |
An inactive marker for a deleted record. |
19 |
Reciprocal rank fusion |
Combining rankings through reciprocal positions. |
20 |
Query slice |
Cases sharing a meaningful evaluation property. |