Semantic Search

Semantic search retrieves information using representations of meaning rather than relying only on exact word matches. A question and a relevant passage may use different wording yet still describe the same idea. The search system must nevertheless distinguish a useful match from a merely related subject.

By Ai Flowi · Published

Embeddings are one way to represent that relationship. They support comparisons between text representations, but the resulting similarity is not a certificate of factual correctness. Semantic search is a retrieval method; answer generation and evidence checking remain separate tasks.

Meaning-based matching versus literal matching

Imagine a document headed “Reversing an issued invoice.” A person searches for “undo a bill already sent.” A literal system may need synonym handling to connect those phrases. An embedding-based approach can represent their related meanings, depending on the chosen model and the surrounding text.

Literal matching still matters when the query contains an exact identifier, product code or quoted error. If the user asks about invoice INV-A, a record for INV-B is insufficient even though both records concern billing. Meaning and identity are different constraints.

For combining literal and semantic retrieval, follow hybrid search RAG; the invoice examples here concern whether a candidate’s meaning fits the requested billing stage.

A paraphrase example and a process-stage trap

Use a fictional billing document set. One note describes reversing an issued invoice, another describes deleting an unsent draft, and a third explains overdue reminders. A query asks “How do I undo an invoice already sent?” The decisive match covers reversal after issue, rather than any procedure that removes billing text.

Authored relevance targets; no search run or score is reported
QueryCandidate passageDesired judgment
Undo an invoice already sent.Reversing an issued invoice.Relevant paraphrase of the requested process stage.
Same issued-invoice questionDeleting an unsent draft.Wrong stage despite related deletion vocabulary.
Why is INV-A overdue?A payment record for INV-B.Wrong identity even if the payment discussion is relevant.
What does error BILL-LOCK mean?General overdue-reminder guidance.The subject alone does not explain the exact error.

These targets help evaluate search quality without inventing rankings. A returned passage should be checked against the requested entity and question. A collection that retrieves only related vocabulary may appear useful in a demonstration while failing the real task.

Why is representation only part of semantic search quality?

The embedding model influences how text is represented, but the source collection determines what can be found. Missing, outdated or badly separated passages cannot be fixed by changing a similarity metric alone. A policy qualification separated from its main sentence may be lost even when the subject is retrieved.

Query wording also matters. A short ambiguous question such as “can I take it?” needs enough conversational context to identify the object. Supplying the wrong object creates the wrong retrieval task. Expanding a query should preserve the user’s meaning rather than quietly add an assumed product.

For access and source-version selection, follow the context engineering guidance.

Distinguish an instructional query from a record query. “How do I reverse an invoice?” needs a procedure; “Was INV-A reversed?” needs the relevant transaction record. A procedure that explains reversal cannot establish whether the operation occurred for that invoice. The candidate set should match the kind of evidence the question requests.

From representation to candidate selection in AI Flowi Workflow

The text embeddings explanation owns the Text Embedder and Embedding Similarity representation contracts.

The Knowledge Base guide covers configuring retrieval of candidate passages.

For the invoice question, review the stage named in each candidate before selecting it for an answer. “Unsent draft” is a hard mismatch for “already sent,” even if both passages discuss undoing a document. Retain the reversal passage’s prerequisites with its procedure so the next stage can determine whether it applies.

A result count such as the catalogue’s top_k controls how many candidates are requested, not how many are useful. Start by identifying the decisive reversal passage in the authored test set. If it is absent, examine the query and collection. If it is present among irrelevant draft instructions, examine selection. Increasing the count alone does not resolve the distinction.

Do not rewrite “undo an invoice” into “delete a draft” merely to obtain a match. That substitutes an interpretation the user did not provide. When the user omits whether the invoice was issued, ask for that stage or search for both stage-specific procedures and retain the ambiguity. Query expansion should expose alternative meanings rather than erase the choice between them.

The candidate-selection deliverable is a small set of applicable passages with reasons for inclusion and exclusion. It precedes the final answer. Keeping the rejected draft passage visible during evaluation helps explain why a semantically close result was unsuitable, without presenting it to the answer model as equally authoritative evidence.

documented in the catalogue; not production-tested by Ai Flowi

Find the search components in the catalogue index; model connections covers your own embedding-provider account/API key, with embedding usage billed separately.

Invoice relevance judgments to carry into review

The RAG evaluation guide owns corpus preparation and the procedure for assessing retrieval separately from generated answers.

For these fictional invoices, the relevance judgment turns on the event already completed. An issued invoice and an unsent draft can share amounts, recipients and much of their wording while requiring different procedures. A candidate about draft deletion stays unsuitable for the issued-invoice question even if it uses the exact verb “undo.” A differently worded reversal passage can fit because its starting state matches.

Negation makes that distinction easy to lose: “not yet issued” and “issued” share a subject and an action word but describe opposite starting states. Preserve the negation when reading the candidate’s heading and prerequisites. Removing it from a short excerpt can make the draft procedure appear applicable. This is a reason to judge the complete stage condition, rather than the number of familiar billing words.

“Send the invoice again” adds another nearby meaning: repeating delivery is different from reversing the issued document. If a question merely says “undo the send,” its intended operation is unresolved. The search response can surface those interpretations without choosing one on the user’s behalf. Ask whether the user means delivery or invoice status before treating either candidate as the answer-bearing procedure.

Common mistakes and related concepts

Semantic search is unsuitable as the sole identity check for an exact account or document identifier. It also cannot recover evidence that was never stored. Avoid assuming an empty or irrelevant result should be converted into a confident answer.

Read text embeddings for representation compatibility and vector database for storage and indexing. The Agent reference explains a tool-capable application layer. Consult documented use cases for starting patterns, while retaining the distinction between a search candidate and evidence that supports an answer.