Semantic Search vs Keyword Search
People often think semantic search is just a smarter keyword search that wins every time. Keyword search matches the exact words, so it is best at names, codes and rare terms. Semantic search matches meaning, so it finds the same idea in other words. Each misses what the other finds. That is why most good systems run both.
Semantic Search
Search that finds text by what it means, not by its exact words.
Semantic search finds text by its meaning rather than by matching the exact words. The question and every stored text are turned into embeddings. The texts whose embeddings sit closest to the question come back first. So a search for 'fix a flat tyre' can find a page about 'mending a punctured wheel'. It is weaker on exact names, codes and rare terms, which is where keyword search does better.
Keyword Search
Search that finds pages with the exact words you typed.
Keyword search finds documents that contain the words in the query. It keeps a table, called an inverted index, that maps each word to the documents that hold it. A query looks up its words and ranks the matches, often with a formula such as BM25. It is fast, cheap and very good at exact names, codes and rare terms. It misses texts that say the same thing in other words.
In one line
- Semantic Search
- Search that finds text by what it means, not by its exact words.
- Keyword Search
- Search that finds pages with the exact words you typed.