Three ways to measure closeness
Once your text is a vector, "how similar?" becomes "how do we measure distance?" There are three answers you will see in production, and choosing wrong silently degrades retrieval quality.
Cosine similarity (default for text)
Measures the angle between two vectors. Identical direction = 1, opposite = -1, perpendicular = 0. It ignores magnitude, which is exactly what you want when document length should not bias similarity.
Euclidean distance (L2)
Straight-line distance in high-dimensional space. Smaller = closer. Useful when magnitude carries meaning (frequency-weighted vectors, image embeddings without normalization).
Dot product (inner product)
Combines angle and magnitude in one number. For unit-length vectors it equals cosine, but it is faster on GPU because there is no normalization. Recommendation systems often pick dot product on purpose so popular items get a boost.
Most modern text embedding models output unit-length vectors
For OpenAI, Voyage, Cohere, BGE, and most sentence-transformers models, the vector is already L2-normalized. That makes cosine, dot product, and a monotonic function of Euclidean distance equivalent — pick whatever your vector store offers most efficiently. Read the model card before assuming.