LESSON 26 / 215·2 min readFoundation

Vector databases, vector search, and semantic search

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Vector
An ordered list of numbers. An embedding is a vector used to represent content for tasks such as similarity search.
Semantic search
Searching by meaning rather than only matching exact words. A search for damaged car may also find vehicle accident documents.
Vector database
A store that can keep embeddings and search for similar vectors, usually alongside information describing each record.
More words from this lesson
Embedding
A list of numbers that represents the meaning of some content. Similar meanings can produce nearby lists of numbers.
Tenant
A customer or organization whose data must stay separate from other customers in a shared application.
Latency
How long a request takes to return a result. Lower latency usually means a shorter wait for the user.
Chunking
Dividing a long document into smaller pieces so relevant parts can be found and sent to the model.
Metadata
Extra information describing a record, such as its owner, date, policy version or document type.

🔴 MUST KNOW · 🟠 SHOULD KNOW for hybrid search and reranking.

Overview

  • A vector database stores vectors and supports similarity queries with metadata.
  • Vector search is the numerical operation; semantic search is the application goal of finding meaningfully related content.
  • Existing databases can also add vector indexes, so you do not always need a separate product.

Why this matters

Comparing a query with every document becomes expensive as the corpus grows.

An everyday example

An organized warehouse can find a nearby matching item without checking every shelf individually.

A technical example

Query the index for the 20 closest chunks where tenantId=t1 and documentStatus=active.

How it works

  1. Store embeddings
  2. Build a search index
  3. Encode query
  4. Apply supported filters
  5. Search candidates
  6. Return text IDs and scores.
  • Approximate nearest neighbor, or ANN, searches efficiently while accepting that it may miss some true closest results.

Architecture and flow

Query → embedding → filtered vector index → top-k chunks → application.

The insurance assistant example

Retrieve relevant active motor-policy clauses for the signed-in customer's insurer and product.

When to use it

For repeated similarity queries over a corpus too large or too active for simple scans.

When to avoid it

A few hundred records may work with exact in-memory comparison; relational or document queries are better for exact IDs.

Interview answer

“A vector index accelerates similarity search. I choose exact or approximate search based on scale, filtering, recall, and latency requirements.”

Benefits, trade-offs, and production considerations

  • HNSW is a graph-like ANN index; IVF partitions vector space into groups.
  • Both trade recall, memory, construction cost, and query time.
  • Benchmark with real tenant filters: global recall numbers can conceal poor filtered search.
PAUSE & RECALL

Can you explain it without the notes?

Vector databases, vector search, and semantic search

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

A vector database stores vectors and supports similarity queries with metadata. Vector search is the numerical operation; semantic search is the application goal of finding meaningfully related content. Existing databases can also add vector indexes, so you…

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Keyword search and BM25

Adapted from 13_AI.MD · “Vector databases, vector search, and semantic search”. Examples are study fragments; framework behavior can depend on your version.