OOmnistu

Blog / AI Software

AI Software

Embeddings explained for app teams: search by meaning, not keywords

Embedding models turn text into vectors so apps can search, dedupe and recommend by meaning. How similarity works and how to store vectors in PostgreSQL with pgvector.

OOmnistu
Reviewed 2026-11-19 · 3 min read

Keyword search fails exactly where users are least precise: they describe what they mean, not the words your content uses. Embeddings are the standard fix - they turn text (or images) into vectors of numbers positioned so that similar meanings land near each other, which lets an app search, cluster and recommend by meaning instead of by matching strings.

This guide explains what an embedding is, how similarity is measured, where embeddings earn their keep in real apps, and how to store and query them in PostgreSQL with pgvector. It follows OpenAI's embeddings guide and the pgvector documentation, checked on 19 November 2026.

What an embedding is

An embedding model converts an input - a sentence, a product description, a support ticket - into a fixed-length list of numbers. OpenAI's documentation describes its text embeddings as measuring the relatedness of text strings: inputs with similar meaning produce vectors that are close together, and unrelated inputs produce distant vectors. The model is trained for this property, so "how do I cancel" and "stop my subscription" end up near each other even though they share almost no words.

How similarity is measured

Once everything is a vector, "find the most relevant documents" becomes geometry. OpenAI's guide uses cosine similarity between the query vector and each document vector, returning the highest-scored documents; the distance between two vectors measures relatedness, with small distances suggesting high relatedness. In practice: embed your documents once, embed the user's query at request time, then ask the database for the nearest document vectors.

Where embeddings earn their keep

Storing vectors in PostgreSQL with pgvector

You do not need a separate vector database to start. pgvector adds a vector column type and similarity search to PostgreSQL, alongside your existing tables. The README documents two index types, and the trade-off is explicit:

That choice is a tuning decision, not a permanent one: the same query syntax works with either, so you can benchmark with your real data and rebuild the index. Keep the measurement habit from database indexes explained - an index that looks right can still disappoint under your actual query mix.

Practical notes before you ship

Sources

Drafted with AI assistance from these sources. Embedding quality depends on your corpus and queries; evaluate retrieval on real examples before committing to a model, chunking strategy or index type.