Skip to main content
Welcome back. This lesson is a hands‑on demo that shows how a vector database can power semantic document search without calling a large language model. We’ll index a small corpus of Warren Buffett’s shareholder letters, convert them into embeddings, store them in a vector database, and run semantic queries that return relevant excerpts by meaning — not just by keyword.
The image depicts a diagram with annual letters being processed into a vector database for querying, titled "Ask Warren Buffet Anything You Want."

The demo app

The demo uses a simple web app with two primary views:
  • A vector search interface for asking natural‑language questions.
  • A document viewer/reference where you can inspect each uploaded letter.
I opened the document viewer to inspect the letters we’ll index.
The image displays a web interface titled "VectorDB Quickstart: Warren Buffett Letters (2020-2024)" with a button labeled "Store All Letters in VectorDB."
Here’s an example of a loaded shareholder letter (2020). You can open any letter to review the original PDF content before or after indexing.
The image shows a webpage titled "Shareholder Letter Viewer," displaying a PDF document titled "2020ltr.pdf." The document contains a table comparing Berkshire's performance to the S&P 500.

Indexing: chunking → embeddings → vectors

Indexing is a three-step pipeline in the backend:
  1. Split each document into smaller chunks (chunking).
  2. Convert each chunk into an embedding vector using an embedding model.
  3. Store the embedding vectors in the vector database for fast similarity search.
In this demo I indexed five letters (2020–2024). After clicking the Store All Letters in VectorDB button, the system processed the documents and returned these metrics:
MetricValue
Documents processed5 letters
Chunks processed436
Embedding dimension384
Notes:
  • Chunking splits long documents into indexable pieces so retrieval returns manageable passages.
  • The embedding dimension (384) is the length of each numeric vector produced by the embedding model; vector comparisons operate on those fixed‑length representations.

Semantic search (meaning-based retrieval)

When you submit a query, the app converts the text into an embedding and compares it with stored vectors to find semantically similar chunks. This returns passages that match the intent of the query rather than exact keywords. Example query: What are Warren Buffett's thoughts on the impact of COVID-19?
The app generates an embedding for the question, searches the vector index, and returns top matches ranked by similarity (or distance). The UI shows the source documents, the excerpt, and a distance/score for each match.
The image shows a semantic search interface displaying a query about Warren Buffett's thoughts on COVID-19 and suggests related questions. It also shows some processed information metrics and a section with search results.
The results identify which letters the excerpts came from — for example, 2024, 2023, 2022 — and include a distance score. Important: some systems report similarity (higher = more similar) while others report distance (lower = more similar). Interpret the displayed metric according to the system you use. Quick interpretation guide:
Reported metricHow to read it
DistanceLower = more semantically similar
Similarity scoreHigher = more semantically similar

Example queries and behavior

Try different natural‑language phrasings. The system matches meaning, so related terms are often found even if the exact word isn’t used.
  • Query: What are his thoughts on Apple?
    Returns passages discussing Apple’s role in Berkshire, praise of its leadership, and references to Apple shares.
The image shows a webpage displaying search results related to thoughts on Apple in letters, with excerpts from a 2021 PDF document mentioning Apple and Berkshire.
  • Related query: What are his thoughts on iPhone?
    Even if “iPhone” does not appear verbatim in an excerpt, the semantic search can return Apple‑related content because the meaning aligns.
The image shows search results related to Apple's stock, with excerpts from annual reports discussing Berkshire's holdings and repurchasing of Apple shares. The document snippets highlight financial aspects and managerial praise.

When to use this pattern

Document search using a vector database is widely used to:
  • Index internal company documents, contracts, and policies.
  • Power knowledge bases and help centers for natural‑language queries.
  • Enable fast, meaning‑based retrieval for downstream workflows.
This demo uses only a vector database and semantic search. No LLMs or external AI APIs (e.g., ChatGPT or Claude) were required to perform the searches shown here.

Next topics

In upcoming lessons we’ll cover:
  • How embeddings are generated and tradeoffs between models.
  • Chunking strategies and how they influence retrieval accuracy.
  • Distance metrics (cosine, Euclidean) and how to interpret scores in practice.

Watch Video

Practice Lab