TOPIC AI
Vector Databases storing and searching by semantic similarity, not exact keywords
IN 10 SECONDS
A vector database (Pinecone, Weaviate, Qdrant, pgvector) stores high-dimensional embeddings alongside metadata. Instead of `WHERE title LIKE '%rag%'`, you search by cosine distance: `ORDER BY embedding <=> query_embedding LIMIT 5`. This finds documents that are semantically similar, even if they share no exact keywords.
GOTCHA The embedding model at search time MUST be the same one used during ingestion. A different model produces vectors in a different latent space — the distances become meaningless. Always version your embedding model alongside your data.
HOW A VECTOR SEARCH WORKS
01 Ingestion each document chunk is passed through an embedding model to produce a vector (e.g., 1536 floats for `text-embedding-3-small`).
02 Indexing the vector + metadata + document text are stored. An approximate nearest neighbor (ANN) index like HNSW is built for fast search.
03 Query the user's query is embedded with the same model, producing a vector in the same latent space.
04 Search the index returns the top-k nearest neighbors by cosine similarity or Euclidean distance, along with their stored metadata.
POKE IT YOURSELF
curl -X POST -d '{"vector":[0.1,0.2,...],"topK":5}' http://localhost:6333/collections/my-collection/points/search — search via Qdrant API
Drill this topic →
~75 sec read