All insights Data & AI · 7 min read

Adding AI search without a rewrite

Semantic search can sit beside your existing search, not replace it. That keeps the risk small.

Laptop showing code next to a coffee cup

Keyword search fails when users describe what they want in different words from the ones in your data. Semantic search fixes that by comparing meaning instead of exact terms. You don't need a new platform to add it.

Start with the data you already have

We generate an embedding (a list of numbers that represents meaning) for each searchable record and store it next to the record. If you already run PostgreSQL, the pgvector extension is usually enough; a separate vector database is rarely needed at the start.

alter table documents add column embedding vector(768);
create index on documents
  using hnsw (embedding vector_cosine_ops);

Blend, don't replace

Pure semantic search is weak on exact matches like product codes and names. We run keyword and semantic search together and merge the results, so codes still match exactly while vague queries improve.

Measure before and after

Before shipping, we build a test set of real queries with the results a person would expect. Every change to the model or ranking is scored against it, so "better" is a number, not an opinion.

  • Hit rate: does the right record appear in the top five?
  • Zero-result rate: how often does a query return nothing?
  • Latency: does search stay fast at peak traffic?

Always keep a fallback

If the embedding service is slow or down, search falls back to keyword results. Users get a slightly worse answer instead of an error page.