Semantic search versus keyword search
Keyword search compares letters: it finds what contains the terms of the query. Semantic search compares meanings: it finds what means the same, even if it uses other words. Neither always wins, which is why current search engines combine the two in what is called hybrid search.
By Joan Martorell
How do they differ?
| Keyword | Semantic | |
|---|---|---|
| What it compares | The terms of the query with those of the text. | The meaning of the query with that of each text. |
| How it does it | A word index and a relevance formula. | Meaning vectors (embeddings) and the distance between them. |
| Gets right | Codes, references, proper names, exact phrases. | Synonyms, descriptions of a need, natural language. |
| Gets wrong | Synonyms and intent. Without added tolerance, typos too. | Codes and meaningless strings. It can return something “similar” that is not what was asked for. |
| What it needs | Only the texts. | An embedding model, and computing one vector per element and per query. |
| Why it returns something | Easy to explain: it contains the word. | Less obvious: it is close in meaning. |
When does keyword search win?
- When the user knows the exact identifier: a reference, a product code, an order number.
- With proper names and uncommon brands, which a language model may not know.
- When you need a guaranteed literal match, for example in legal texts.
When does semantic search win?
- With synonyms: “sofa” and “couch”, “laptop” and “notebook”.
- When the query describes an intent and not an object: “something to hang a picture”.
- With natural language questions, like those of a help centre.
- When the catalogue uses a technical vocabulary and users a colloquial one.
What is hybrid search?
It is running both at once and combining their results. That way a typo is resolved by text matching, a synonym is resolved by semantic matching, and the user does not need to know which of the two did the work.
XEYE works this way on every query. It computes a text score with fuzzy matching, which tolerates typos and partial words, and a semantic score, and returns a combined score per result. If you ask for it with include_score_breakdown, the response includes the two separately.
What does the data say?
We measured XEYE with queries labelled by type on three catalogues in Spanish. This is the fraction of queries in which the expected element came in first position:
| Query type | 10 products | 250 activities | 4,727 codes |
|---|---|---|---|
| Synonym | 0.89 | 0.93 | 0.43 |
| Intent | 1.00 | 0.77 | 0.50 |
| Typo | 1.00 | 0.75 | 0.67 |
| Attribute | 0.89 | 0.78 | 0.50 |
Two takeaways. In the Products catalogue, synonym and intent queries, which a keyword search engine cannot resolve, hit the first position in 89% and 100% of cases, and in Activities synonym is the strongest category. And in the large, dense catalogue, the strongest category is typo, the only one that text matching can resolve on its own. The two signals complement each other. The full data is in measured results.
Which one should I choose?
- Keyword only if your users almost always search by code or exact name.
- Hybrid in almost every other case: product catalogues, help centres, directories.
- Semantic only is rarely worth it: you lose typo tolerance and accuracy with codes.
If you want to try hybrid search without building anything, a semantic search API gives it to you ready-made.
Frequently asked questions
Does semantic search understand typos?
- Not reliably. A typo can change the vector of a short word a lot. That is why hybrid search adds fuzzy text matching, which is designed for typos.
Is semantic search slower?
- It adds one step: turning the query into a vector. In our measurements, the full hybrid search takes 28 to 55 milliseconds on average on the server with the default model.
Do I need a lot of data for it to work?
- No. The models come already trained on general text. It works with a catalogue of ten elements.
What is fuzzy matching?
- A text comparison that measures how similar two strings are instead of requiring them to be equal. That is why “runing shoos” finds “running shoes”.
Try it with your own data
Create an account, upload a list and run your first search in about five minutes. You start with €5 of credit, no card required.
Keep reading
- Semantic search API: what it is and how to choose oneA semantic search API returns the elements in your catalogue that mean the same as the query. What it does, what you need and how to choose one.
- Measured results: XEYE accuracy and latencyTop-1 of 0.91 on a catalogue of 10 products, 0.85 with 250 elements and 0.49 with 4,727 codes. Mean latency of 28 to 55 ms. Methodology and limits.
- Semantic search for your online shop: how to set it upHow to add search that understands synonyms, intent and typos to an online shop: the data it needs, the steps to set it up and what it does not do.