Semantic Search

What is Semantic Search?

Semantic search is a method of search that finds the most relevant results for a search query based on the meaning, or human intent of the query. Semantic search is often talked about in relationship to lexical search, which is a way of searching by literal, ‘exact matches’ between a query string and potential results.

Most of us web developers are familiar with lexical search, because it’s a common pattern in web programming — checking equality between two strings. And it’s a common pattern in talking to a database. You’ll even hear lexical search called “database lookup search” sometimes because that’s historically how most databases provide lookup capabilities by default.

But semantic search works a lot more like humans think — a lot of times in language, the intent & meaning of a question can be (a lot) broader than the literal exact matches possible.

Think about a simple example — searching for products. You might be looking for red running shoes. Generally, a semantic search systems will understand your intent if you type “red sneakers”. Or even “red kicks”. You can see how powerful this is in some build patterns, when you need your app’s search to understand what a user means, not just what they typed.

Is lexical search better than semantic search?

Not at all! They’re just different tools for different jobs. There are a lot of times lexical search is the right tool — looking up people in an employee directory, looking up a specific error code. And there are other times you need the power & flexibility of semantic understanding.

Back to Glossary