
Vector databases: searching by meaning and similarity
Archived article with editorially revised content
Why search by meaning?
Vector search uses sequences of numbers representing features of text, images or other data. Embeddings make it possible to retrieve similar content without an exact keyword match. A visitor searching for an “easy-to-manage business website” might find a description of a “clear, practical company site”. This is a possible match, not guaranteed understanding. Its usefulness depends on the model and the collection; similarity by itself does not establish truth or suitability for a particular project.
An embedding is not the document
An embedding model turns a passage into a vector of a fixed length. Individual coordinates usually cannot be read as simple labels such as “price” or “quality”. Questions and documents need compatible representations in the same vector space. Vectors from different models are not necessarily comparable even when they have the same number of dimensions. Keep the original text, identifier and source alongside the vector so that a result remains traceable, editable and verifiable.
Illustrative 2D space · not actual model output
Similarity depends on the metric
Cosine similarity compares vector directions: matching directions give 1, while perpendicular directions give 0. Cosine distance can be calculated as 1 minus similarity. Euclidean distance or a dot product may suit a different model. Choose the metric recommended for the representation you use. A score of 0.8 does not mean a result is “80% true”. Applying one arbitrary threshold to unrelated models can exclude useful answers and admit irrelevant ones.
Same direction: cos = 1 · Perpendicular: cos = 0
From content to a searchable collection
Long documents are split into meaningful passages. Each receives an embedding, a source reference and metadata such as language and access permissions. A question is embedded too, and the system retrieves nearby vectors. In a support knowledge base, an everyday question can then lead to the relevant part of a guide. Very short passages may lose context; large ones may mix several topics. Evaluate the splitting strategy using realistic questions with known relevant answers.
Compatible model · enforce permissions · verifiable sources
Combine keywords and meaning
Product codes, names and exact regulation numbers still benefit from keyword search. Hybrid retrieval can combine lexical and vector results, with an additional reranking stage if useful. Filtering by language, date or category is a separate task from calculating similarity. Access control is more than a convenient filter: a document belonging to another customer must not appear as a result or become context for an AI response. Hiding it in the browser cannot enforce that boundary.
An addition, not a universal replacement
Traditional databases can already manage images and complex information. Vector functions may be a separate service or part of an existing system, for example PostgreSQL with pgvector. Exact search may be sufficient for a small collection. An approximate index can speed up a larger one while missing some relevant neighbours. Choosing an index involves trade-offs between latency, memory and retrieval quality. Measure these against your own content rather than relying on a polished demonstration.
What does this mean for an AI application?
Retrieval-augmented generation, or RAG, provides retrieved passages as context to a language model. It is neither retraining nor a guarantee of accurate answers. A useful implementation shows sources, handles uncertain matches and enforces permissions. Content updates and deletions must reach the index as well. Changing the embedding model may require creating new vectors. The practical objective is to help visitors find reliable, accessible information faster, with relevance and errors checked against real usage.