Vector Search

How AI search finds relevant content by comparing embedding vectors — ANN algorithms (HNSW, ScaNN), distance metrics, hybrid search, and what it means for SEO.

First published: Jun 24, 2026 · Last updated: Jul 19, 2026 · Advanced
demand #7 in How Search Works#12 in AI Search#71 on the site

Vector search finds content by comparing the meaning of a query against stored content as embedding vectors, retrieving the closest ones in a high-dimensional space. At scale it uses approximate nearest neighbor (ANN) algorithms — HNSW, IVF, FAISS, ScaNN — that trade a sliver of recall for huge speed gains, because exact comparison over billions of vectors is impossible in real time. It's a method for achieving semantic search, not a synonym for it, and it's the retrieval step inside every RAG system, including what feeds AI Overviews. Production search rarely runs it alone: the real pattern is hybrid (keyword BM25 + vector + reranking). For SEO there's no knob to turn — vector proximity is the new gate into the candidate pool, and it rewards topically coherent, passage-level depth over keyword density.

TL;DR — Vector searchVector search finds content by comparing the meaning of a query against stored content as numerical vectors, retrieving the closest ones in a high-dimensional embedding space. At scale it uses approximate nearest neighbor (ANN) algorithms — not exact comparison — to search billions of vectors in milliseconds. retrieves the closest vectors to a query vector in a high-dimensional embeddingEmbeddings are dense numerical vectors — lists of floating-point numbers — that represent the meaning of text in a high-dimensional space. Semantically similar content lands close together, so search and AI systems can match by meaning, not just keywords. space, using approximate nearest neighbor (ANN) algorithms — HNSW, IVF, FAISS, ScaNN — because exact comparison over billions of vectors is impossible in real time. ANN is approximate by design: it trades a sliver of recall for orders-of-magnitude speed. Vector search is a mechanism for semantic searchSemantic search is meaning-based retrieval — matching what a user means, not just the words they typed. Search engines detect entities, expand synonyms, infer intent, and rank by conceptual relevance, which is why keyword stuffing lost its power and topical depth gained it., not a synonym for it, and it’s the retrieval step inside every RAGRAG is the retrieve-then-generate pattern behind AI search: the system retrieves relevant passages from an external index at query time, injects them into the model's context, and generates an answer grounded in those sources — without changing the model's weights. system (AI OverviewsAI Overviews are the AI-generated summary box Google shows above or within its regular search results, written by Gemini models from pages retrieved out of Google's normal Search index. It's a Search feature, not a separate platform or index. included). Production rarely runs it alone — the real pattern is hybrid: BM25 + vector + rerankingReranking is the second stage of a retrieval pipeline: after a cheap, broad first pass pulls a candidate set of documents or passages, a slower, more precise model re-scores and reorders that shortlist by true relevance before the results are served or handed to an LLM.. For SEO there’s no knob to turn; vector proximity is the gate into the candidate pool, and it rewards topically coherent, passage-level depth.

Where vector search sits

Vector retrieval is one component that can feed ranking or generation; it is not a complete search system by itself. Evidence for this claim HNSW is an approximate nearest-neighbor method that organizes vectors in a multilayer navigable graph for efficient search. Scope: The HNSW algorithm and reported evaluations; production indexes may use different ANN methods and parameters. Confidence: high · Verified: Malkov and Yashunin: HNSW No fixed distance threshold or indexStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. algorithm is universally best. Evidence for this claim Embedding vectors can be compared by distance to retrieve related items. Scope: OpenAI embedding guidance; retrieval quality depends on model choice, corpus, index, filters, and evaluation. Confidence: high · Verified: OpenAI: Embeddings guide

EmbeddingsEmbeddings are dense numerical vectors — lists of floating-point numbers — that represent the meaning of text in a high-dimensional space. Semantically similar content lands close together, so search and AI systems can match by meaning, not just keywords. give you the vectors — vector search is what you do with them. If embeddingsEmbeddings are dense numerical vectors — lists of floating-point numbers — that represent the meaning of text in a high-dimensional space. Semantically similar content lands close together, so search and AI systems can match by meaning, not just keywords. are the “what is a vector” half of the story, this is the “now find the closest ones” half. And it’s worth being precise about a distinction the industry blurs constantly: semantic searchSemantic search is meaning-based retrieval — matching what a user means, not just the words they typed. Search engines detect entities, expand synonyms, infer intent, and rank by conceptual relevance, which is why keyword stuffing lost its power and topical depth gained it. is the goal; vector search is one method for reaching it. Semantic searchSemantic search is meaning-based retrieval — matching what a user means, not just the words they typed. Search engines detect entities, expand synonyms, infer intent, and rank by conceptual relevance, which is why keyword stuffing lost its power and topical depth gained it. can also lean on knowledge graphsThe Knowledge Graph is Google's database of entities — people, places, organizations, and things — and the factual relationships between them. It's separate from any single website's structured data: your schema markup is one of many possible inputs to the graph, not the graph itself., entity recognition, and intent matching. Vector search specifically means ANN retrieval over an embedding space — so the two aren’t synonyms, even though they’re used as if they were.

How vector search works, step by step

The pipeline is the same whether you’re Google or a weekend RAG project:

The query is embedded into the same representation as indexed content before nearby candidates are retrieved. Source: Vector Search

Documents are embedded and indexed before the search. At query time, the system embeds the query, searches an approximate-nearest-neighbor index, finds nearby vectors, and returns their corresponding documents as candidates.

© Patrick Stox LLC · CC BY 4.0 ·

  1. Embed the content. An encoder model converts each chunk of content into a vector. Note chunk — vector search doesn’t compare whole pages; it compares passages. ChunkingChunking is splitting a document into smaller passages so AI systems can embed, index, and retrieve the single most relevant piece — not the whole page — in response to a query. It's a foundational step in RAG pipelines and the conceptual cousin of Google's passage ranking. is the unit of retrieval, which is why passage-level density matters more than page-level keyword presence.
  2. Build an index. The vectors go into a vector index built for fast nearest- neighbor lookups (an ANN index — more below).
  3. Embed the query. At query time the same model turns the user’s query into a vector in the same space.
  4. Run ANN search. The index returns the top-k vectors closest to the query vector — the candidate set.
  5. Rank and return. Those candidates get scored, often reranked, and the best are served (or, in RAG, passed to an LLMA large language model (LLM) is a deep-learning model trained on massive text corpora to predict the next token and generate human-like text. LLMs use the transformer architecture and power AI search features like Google's AI Overviews (Gemini) and Bing Copilot (GPT-4). to generate from).

Approximate nearest neighbor — why “approximate”

Finding the exact nearest neighbors means comparing the query to every stored vector — O(N) per query. At billions of vectors, in milliseconds, that’s a non-starter. So production search uses ANN: indexingStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. structures that find the nearest neighbors almost perfectly while skipping the vast majority of comparisons.

As Elastic puts it, ANN “sacrifices perfect accuracy in exchange for executing efficiently in high dimensional embedding spaces, at scale.” Weaviate frames the same tradeoff as trading “a bit of accuracy for a huge gain in speed.” This is not a bug — it’s the engineering choice that makes vector search possible at all. The metric for “how good is the approximation” is recall: Google defines it as “the percentage of nearest neighbors returned by the index that are actually true nearest neighbors.” Google’s own Vector Search service — rebranded from “Vertex AI Vector Search” and now documented under the Gemini Enterprise Agent Platform — reports recall of 95–98% — you give up a couple of percent of the true neighbors and get search at web scale in return.

Key ANN algorithms

You don’t need to implement these, but knowing the names demystifies a lot of AI- search discussion.

  • HNSW (Hierarchical Navigable Small World) — the industry default. A multi- layer graph where the top layers are sparse “express lanes” with long-range connections for fast traversal, and the bottom layers are dense “local roads” for precise navigation. It achieves roughly logarithmic search complexity, which is why it dominates production. Used by Weaviate, Pinecone, pgvector, Qdrant, and more. The catch is memory: HNSW indexes are RAM-hungry. Pinecone’s verdict — “HNSW gives us great search-quality at very fast search-speeds — but there’s always a catch — HNSW indexes take up a significant amount of memory.”
  • IVF (Inverted File Index) — partitions the space into clusters (k-means), then at query time only searches the few clusters nearest the query (nprobe). Pinecone calls it “a very popular index as it’s easy to use, with high search- quality and reasonable search-speed… a good scalable option.”
  • FAISS — Facebook AI’s library (Johnson, Douze, Jégou) for billion-scale similarity search. It’s a toolbox, not a single algorithm: a flat exact baseline (IndexFlatL2), clustered IVF, product-quantized IVFPQ for 4–64x memory compressionCompression (HTTP content encoding) shrinks text-based responses — HTML, CSS, JS, JSON, SVG, XML sitemaps — before they're sent over the network, using an algorithm like Gzip, Brotli, or Zstd, so the browser or crawler downloads fewer bytes. It's not a ranking factor, but it speeds up page loads and helps pages stay under crawler fetch limits., and an HNSW implementation. Its GPU adaptation reported an 8.5x speedup on k-NN search.
  • ScaNN (Scalable Nearest Neighbors) — Google’s library, open-sourced, the same family of tech behind Google Image Search, YouTube, and Google Play. Its innovation is anisotropic vector quantization: instead of minimizing average distance, it “more heavily penalizes quantization error that is parallel to the original vector,” because directional error disproportionately harms the high- inner-product (most relevant) results. The payoff: it “outperforms other vector similarity search libraries by a factor of two” on ann-benchmarks.com — roughly twice the queries per second at a given accuracy.
  • Flat (exact) index — no approximation at all; brute-force, most accurate, slowest. Pinecone notes flat indexes “produce the most accurate results” and are the right call when search quality is paramount or the index is small (under ~10K vectors). Above that scale, you move to ANN.

The through-line: every ANN index is a dial between recall, latency, throughput, and memory. As Weaviate puts it, most vector databases let you “configure how your ANN algorithm should behave… to find the right balance.”

Distance metrics

“Closest” needs a definition. Three are common:

  • Cosine similarity — the default for text. It measures the angle between two vectors, ignoring magnitude, so a short document and a long one on the same topic score alike. Weaviate: “Cosine similarity is commonly used in Natural Language Processing… It measures the similarity between documents regardless of the magnitude.”
  • Dot product (inner product) — used when relevance is defined by inner product (the MIPS problem ScaNN optimizes for).
  • Euclidean distance (L2) — straight-line distance; used when magnitude carries meaning.

Here’s the practical shortcut: for normalized vectors, cosine similarity and dot product give identical rankings, and most modern embedding models normalize their output to unit length. OpenAI says it plainly — “We recommend cosine similarity. The choice of distance function typically doesn’t matter much” — precisely because their embeddings are length-1. The real rule, per Weaviate: “Use the distance metric that matches the model that you’re using… There is no ‘one size fits all’.”

Vector databases

A vector database stores vectors and runs ANN over them so you don’t build the index infrastructure yourself. The common names — Pinecone (managed), Weaviate (hybrid searchHybrid search runs keyword (lexical/BM25) search and vector (semantic) search together, then merges the two result lists into one ranking — commonly with Reciprocal Rank Fusion — so it catches both exact-term matches and meaning-based matches that either method alone would miss. built in), Chroma and FAISS (great for prototyping/in-process), Qdrant, Milvus (self-hosted scale), and pgvector (a Postgres extension, for teams already on SQL). I’m listing, not ranking — the right choice depends on scale, whether you want managed vs. self- hosted, and whether you need hybrid search out of the box. At Google/Bing scale, the “database” is internal ScaNN/ANN infrastructure rather than any of these.

Hybrid search — how production actually works

The “keyword search vs. vector search” framing is a false binary. Pure vector search misses exact-match queries — error codes, SKUs, proper nouns — and pure keyword search misses semantic variants. So serious systems run hybrid search: keyword (BM25) and vector retrieval in parallel, results fused (commonly with Reciprocal Rank Fusion), then the top candidates reranked by a cross-encoder. Microsoft defines hybrid search as “the execution of vector search and keyword search in the same request… The queries execute in parallel, and the results are merged into a single response and ranked accordingly.” Google’s Vector Search supports the same three modes — dense (semantic), sparse (keyword), and hybrid. If you take one thing from this section: production retrieval is almost never vector-only. It’s the combination that wins.

This is not a 2023 ChatGPT-era novelty. The infrastructure predates the LLM wave by years:

  • ScaNN (ICML 2020, open-sourced) powers Google Image Search, YouTube, and Google Play, and underpins Google’s Vector Search product (the service formerly branded Vertex AI Vector Search) — which “shares the same backend” as those consumer products. Google’s Kaz Sato called the technology “one of the most important components of Google’s core services.” Performance spec: “tens of thousands of requests per second… in less than 10 ms for the 90th percentile with a recall rate of 95–98%.”
  • Bing was running 100B+ vector indexes by 2019. In Microsoft’s own words, Bing could “search through this giant index of 100 billion-plus vectors to find the most related results in 5 milliseconds.” That’s six-plus years ago.
  • Dense Passage Retrieval (DPR, EMNLP 2020) proved dense vector retrieval could beat Lucene-BM25 by 9–19% absolute in top-20 passage retrieval accuracy with a simple dual-encoder. DPR is the blueprint modern RAG retrieval follows — the retrieval step behind AI OverviewsAI Overviews are the AI-generated summary box Google shows above or within its regular search results, written by Gemini models from pages retrieved out of Google's normal Search index. It's a Search feature, not a separate platform or index. is a descendant of this pattern.
  • MUVERA (2025) makes multi-vector retrieval as fast as single-vector search — roughly “10% higher recall with ~90% lower latency” than prior methods.
  • TurboQuant (ICLR 2026) compresses vectors for nearest-neighbor search with reported 6x memory reduction and effectively zero accuracy loss.

The point isn’t to memorize the roadmap — it’s that embedding-based retrieval is how the big engines find relevant content, and has been for years.

What this means for SEO

Let me be careful here, because this is where SEO advice usually overreaches.

Vector proximity is the new gate into the candidate pool. In RAG-based answers, retrieval happens before generation. If your passage isn’t semantically close to the query embedding, it never enters the shortlist the model writes from — so it can’t be cited. That’s the mechanism.

But there is no “vector search optimization” knob. The underlying signal is semantic coherence and topical depth — which is what quality content always required. Vector search doesn’t reward a new trick; it penalizes thin contentThin content is web content that provides little or no value to users. Google's spam policies name it 'thin content with little or no added value' — and it's about value per page, not word count. and keyword stuffing (which don’t form a coherent neighborhood in embedding space) and rewards genuinely comprehensive, well-structured coverage. As I put it in the embeddingsEmbeddings are dense numerical vectors — lists of floating-point numbers — that represent the meaning of text in a high-dimensional space. Semantically similar content lands close together, so search and AI systems can match by meaning, not just keywords. piece, echoing Danny Sullivan on BERT: there’s largely nothing to “optimize for” here — you make your content cluster cleanly near the queries it should answer.

Two concrete implications that do follow:

  • ChunkingChunking is splitting a document into smaller passages so AI systems can embed, index, and retrieve the single most relevant piece — not the whole page — in response to a query. It's a foundational step in RAG pipelines and the conceptual cousin of Google's passage ranking. matters. Retrieval operates on passages, not whole pages. A page can rank for nothing if no individual passage is a clean semantic match. Write passages that stand on their own.
  • Topical depth and entity coverage are how you occupy the right neighborhood in embedding space. Shallow, scattered content embeds into a fuzzy region near nothing in particular.

Vector search is the retrieval engine behind RAGRAG is the retrieve-then-generate pattern behind AI search: the system retrieves relevant passages from an external index at query time, injects them into the model's context, and generates an answer grounded in those sources — without changing the model's weights. and AI answers; passage rankingPassage ranking is a Google AI system that scores individual sections ('passages') of a page so a single page can earn multiple relevance scores for different queries. Google still indexes whole pages — only the ranking changed. is what happens to the candidates after retrieval; and the AI crawlersAI crawlers are bots from AI companies that fetch web pages to train language models, build AI-search indexes, or answer live user questions. They come in three categories, each with its own user-agent tokens and its own robots.txt controls. feeding these systems embed and vector-index what they fetch. For the wider pipeline, see How Search WorksSearch works in three stages — crawling, indexing, and serving (ranking). A page has to clear each one to appear in results: getting crawled doesn't mean you're indexed, and getting indexed doesn't mean you rank..

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.