# Semantic Search

> The Semantic Search is a search technique that finds results by meaning rather than by exact keyword matches.

## What is semantic search vs keyword search?

The technique that compares the meaning of a query and documents using embeddings. Finds relevant results even when they use different words, for example matching 'reset password' with 'restore account access'.

- Topic: Retrieval
- Type: technique

## Example

Wrong:

```js
const results = await index.query(await embed(query), { topK: 5 });
return results;
```

Right:

```js
const results = await index.query(await embed(query), { topK: 5 });
return results.filter((r) => r.score >= MIN_SCORE);
```

Dropping low-score matches avoids returning unrelated results when nothing in the index fits the query.

## Common mistakes

- Semantic search misses exact matches like error codes or product IDs.

## Key points

- Queries and documents are embedded with the same model.
- Exact terms like IDs, codes and names are also covered by keyword search.
- Results below a relevance threshold are dropped instead of always returning top results.

## Interview questions

### Does semantic search work across languages?

It can, with a multilingual embedding model that places similar meanings in different languages close together.

### Why does semantic search miss exact matches?

Embeddings capture general meaning, so rare tokens like error codes or SKUs may not stand out. Add keyword search for those.

### Is semantic search the same as vector search?

Mostly. Semantic search is the goal, finding by meaning; vector search over embeddings is the usual way to do it.

## Related cards

- [Embeddings](https://wonderium.dev/ai/embeddings.md)
- [Hybrid Search](https://wonderium.dev/ai/hybrid-search.md)
- [Vector Database](https://wonderium.dev/ai/vector-database.md)
- [Reranking](https://wonderium.dev/ai/reranking.md)
- [Search Engine](https://wonderium.dev/web/search-engine.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/semantic-search
- Last updated: 2026-11-25
