Vector Search
A search method that finds results based on meaning rather than keywords by comparing the mathematical representations (vectors) of queries and documents.
Vector search is a search method that finds results based on semantic meaning rather than keyword matching. It works by comparing the mathematical representations (vectors) of your search query against the vectors of items in a database, returning the closest matches by meaning.
How vector search differs from keyword search
Traditional keyword search matches the literal words in your query against documents. If you search for "how to reduce employee burnout" but the relevant article uses the phrase "preventing workplace exhaustion," keyword search misses it. Vector search finds it because the underlying meanings are similar.
How vector search works
- Indexing: Each document (or chunk of a document) is converted into a vector using an embedding model. These vectors are stored in a vector database.
- Querying: When you search, your query is also converted into a vector using the same embedding model.
- Similarity calculation: The query vector is compared against all stored vectors using a similarity metric (cosine similarity, dot product, or Euclidean distance).
- Ranking: Results are returned ordered by similarity score β most semantically similar first.
Approximate nearest neighbour (ANN) search
Comparing a query against every stored vector would be too slow for large databases. Vector databases use ANN algorithms that sacrifice a tiny amount of accuracy for dramatically faster search:
- HNSW (Hierarchical Navigable Small World): Graph-based algorithm that is fast and accurate. The most popular choice.
- IVF (Inverted File Index): Clusters vectors and only searches relevant clusters.
- Product quantisation: Compresses vectors to reduce memory and speed up comparison.
Vector search in practice
- RAG systems: The retrieval step in RAG is typically vector search β finding the most relevant document chunks to include in the LLM's context.
- Semantic document search: Searching knowledge bases, help centres, and documentation by meaning.
- Product discovery: E-commerce search that understands intent ("lightweight laptop for travel") rather than requiring exact product attribute matches.
- Image search: Finding visually or conceptually similar images.
- Recommendation: Suggesting similar items based on semantic similarity.
Hybrid search
The most effective search systems combine vector search with keyword search. Keyword search catches exact matches (product names, technical codes, proper nouns) that vector search might rank lower. Vector search catches semantic matches that keyword search misses. Combining both produces the best results.
Popular vector search solutions
- Pinecone: Managed vector database.
- Weaviate: Open-source with rich features.
- Qdrant: High-performance open-source option.
- pgvector: PostgreSQL extension for vector search.
- Elasticsearch: Added vector search to its existing search platform.
Why This Matters
Vector search is the technology that makes modern AI search and RAG systems work. Understanding it helps you design search experiences that actually understand what users are looking for, build effective knowledge retrieval systems, and evaluate vector database solutions for your organisation.
Related Terms
Continue learning in Practitioner
This topic is covered in our lesson: RAG and Knowledge Retrieval