Maxim Mironjuk
-
September 28, 2025
Classic text search finds documents that contain the same words as the query. It does not recognize that a search for waterproof jacket should also match a product called weatherproof outdoor coat, even though not a single word overlaps. Vector search solves exactly this problem: text is represented as embeddings, points in a high dimensional space, and similar meaning translates into spatial closeness. The real challenge starts afterward, because finding the nearest neighbor across millions of vectors is expensive. Approximate kNN with the HNSW algorithm solves this scaling problem by trading a small accuracy loss for enormous speed gains. This article explains how HNSW works technically, where exact kNN still has its place, and how the two central levers, num_candidates and the similarity metric, are configured in practice.