Semantic Search and How Vector Search Works
Published Updated
Semantic search matches a query to content by meaning using embeddings, which are numerical representations of text. Vector search compares those embeddings so staff can find a policy even when they describe it in different words. For an intranet with both plain-language questions and exact document codes, start with hybrid search and compare it with the search you already use.
What Semantic Search Means
Keyword search scores matches on the words or tokens in a query. Semantic search can find a relevant item even when those words are absent. Someone who asks “How do I get money back for a work trip?” may be looking for a document called “Travel expense reimbursement policy”.
In a small test using five fictional document titles, keyword search with BM25 gave that policy a score of zero because its title shared no terms with the question. Vector search with the public all-MiniLM-L6-v2 model ranked the policy third. Both searches put “How to get money back from a supplier” first. The vector match found a candidate the keyword search missed, but the candidate list still needed better ranking.
How Vector Search Works
Vector search ranks content by comparing a query’s embedding with embeddings stored when the content was indexed.
- Split longer documents into passages. Run each passage through an embedding model and store its vector with a reference to the source.
- When someone searches, embed the query with the same model version used for the content. Use its query-specific input format if it has one. The query and content need to share the same coordinate space for distances between them to mean anything.
- Find the stored vectors closest to the query vector. Cosine similarity is one way to score how closely the vectors point in the same direction. The cosine similarity calculator shows what changes when the vectors point in different directions.
- Return the top passages or group them into ranked documents. Keep the title and source link with the result so the reader can open the material that matched.
Approximate nearest neighbour search uses an index to look for likely matches without scoring every vector. It reduces search work on large collections, at the cost of sometimes missing a neighbour that an exhaustive search would find. A vector database can store those vectors and run the similarity search.
Hybrid Search and Reranking
Hybrid search is usually a better starting point for an intranet with mixed queries. Run keyword and vector search together, then merge their results. The keyword branch can catch a product code, an uncommon name or an acronym that carries little meaning to the embedding model. The vector branch can find passages that use a different term for the same task.
BM25 ranks text using matching terms. It gives more weight to terms that are uncommon in the collection, accounts for document length and limits the benefit of repeating a term. Preserve identifiers in exact-match fields where punctuation or leading zeros distinguish records. In Azure AI Search’s hybrid search, reciprocal rank fusion combines the positions from the two ranked lists without comparing their raw scores directly.
A reranker takes the top candidates and reads their text against the original query. It can move a passage about employee reimbursement above one about supplier refunds because the first passage fits the full question. It can only reorder candidates the first search returned, and its extra scoring adds latency.
Apply filters for date ranges and document types using indexed metadata. Treat permissions as an eligibility check before passing candidates to a reranker or an assistant. For example, a query about parental leave can search current policy documents the employee is allowed to see, even if a draft policy has similar wording.
Where Semantic Search Struggles
Semantic search can find passages about the right topic and still put the wrong document first. Evaluate it against the kinds of mistakes your staff need to avoid.
| Query type | What can go wrong | What to test |
|---|---|---|
| Exact identifier | A vector model can score two similar part numbers close together. | Add an exact-match field and check that searching one code returns the matching record first. |
| Negation | “Devices approved for travel” may rank well for “devices not approved for travel”. | Judge whether the returned passage answers the right polarity. Use an explicit status filter where the source records it. |
| Very short query | “Access” could mean a building pass or permission for a system. | Check which task users meant. Allow them to narrow the results by topic or document type. |
| Internal jargon | The embedding model can miss a team acronym or mistake it for another term. | Check queries with internal names. Give the keyword branch an alias or an exact term to match. |
| Mixed-language content | A model may match a query poorly when the relevant source is in another language or switches languages mid-document. | Test the actual query and document language pairs before choosing a multilingual model. |
Take real search queries from staff and remove unnecessary personal information. Ask people who know the work to identify the best accessible document for each query and mark other acceptable results. Run the same queries against keyword, vector and hybrid search. Compare how often the best accessible result appears in the first few positions and measure the response time. Keep some judged queries out of tuning so you can check whether ranking changes generalise.
When a document changes, regenerate the embeddings for its affected passages and remove obsolete versions. A change of embedding model usually means re-embedding the whole collection because the new vectors occupy a different coordinate space. Budget for embedding computation, rebuilding the index and running the old and new indexes together while you check the new ranking.
Review clicks alongside feedback. A top result may get clicked because of its position. If people often reopen search, refine the query and settle on an older result, review the sequence with someone who knows the task. Let staff flag the right document or say the answer was missing, so you can tell a ranking miss from a content gap.
Semantic Search Inside an Organisation
Start with a collection where staff can describe what they struggle to find. An intranet or SharePoint library can match everyday questions to formal policy titles. Policy collections need effective dates and version filters. Ticket histories can surface similar incidents, while product catalogues benefit from pairing descriptive queries with exact product codes.
Carry the source system’s access rules into the search index and refresh them when permissions change. Apply those rules to results and snippets before displaying them. This is permission trimming. Test with a user who can open a document and one who cannot, then revoke access and verify that the result disappears.
An AI assistant can use semantic search to retrieve relevant passages before generating an answer. The assistant receives only passages the caller is allowed to see and can link to the underlying documents. This is the retrieval step in retrieval-augmented generation. An assistant that retrieves an old policy can produce a plausible answer from it, so track document ownership and currency in the knowledge management system.
Microsoft Search already finds files, pages and sites in SharePoint and returns results relevant to the Microsoft 365 app where the search starts. Microsoft 365 Copilot uses Microsoft Graph and a semantic index for supported content, including text-based files on searchable SharePoint Online sites. Results follow the user’s permissions. For data outside Microsoft 365, a supported connector can index it or fetch it at query time. Build a custom index when a connector can’t cover the source under your access rules or you need ranking and filters specific to the job.
Before launch, record how often staff get zero results and how long they take to find the right document on representative tasks. Measure both again after launch, alongside valid results near the top and permission checks. If zero-result searches fall while time to find stays the same, inspect the first few results for those tasks before indexing more content.
Related reading
Cosine Similarity Calculator for Vectors
Paste two vectors, such as embeddings from a model, to get their cosine similarity, angle and distance, with the dot product and each vector’s length.
Vector Databases and When pgvector is Enough
Do you need a dedicated vector database for AI search, or will pgvector in PostgreSQL do? See how vector databases work and how to choose one.
What is RAG in AI? Pipelines, Uses and Limits
Retrieval-augmented generation lets an AI model answer from your own documents. A RAG pipeline has weak points, and agentic RAG helps with some of them.
Knowledge Management Systems and Where AI Helps
Staff can’t find the policy, the latest template or who knows the answer. See how knowledge management systems work, which type fits and what AI changes.
embeddings
Embeddings is an Australian AI consultancy. We design, build and run AI systems inside the software, documents and data organisations already use, from offices in Perth and Melbourne.
About Embeddings