---
title: "Fuzzy Search"
url: "https://docs.ravendb.net/6.2/client-api/session/querying/text-search/fuzzy-search"
version: "6.2"
language: "nodejs"
---

# Fuzzy Search

> Client language: Node.js. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/fuzzy-search.md), [Java](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/fuzzy-search.java.md), [Python](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/fuzzy-search.python.md), [PHP](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/fuzzy-search.php.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - A **fuzzy search** retrieves documents containing terms that closely match a given term instead of exact matches,
>   assisting in finding relevant results when the search term is misspelled or has minor variations.
>
> - Use the `fuzzy` method when querying with `whereEquals`.
>
> - In this page:
>   - [Fuzzy search example](#fuzzy-search-example)
>   - [Syntax](#syntax)

## Fuzzy search example

### Query

```javascript
const employees = await session
  .query({ collection: "Companies" })
   // Query with a term that is misspelled
  .whereEquals("Name", "Ernts Hnadel")
   // Call 'fuzzy' 
   // Pass the required similarity, a number between 0.0 and 1.0
  .fuzzy(0.5)
  .all();

// Running the above query on the Northwind sample data returns document: companies/20-A
// which contains "Ernst Handel" in its Name field.
```

### RQL

```sql
from "Companies"
where fuzzy(Name = "Ernts Hnadel", 0.5)
```

## Syntax

```javascript
fuzzy(fuzzy);
```

| Parameter | Type | Description |
| - | - | - |
| **fuzzy** | `number` | A value between `0.0` and `1.0`.<br />With a value closer to `1.0`, terms with a higher similarity will be matched. |

## See also

- [Query overview](https://docs.ravendb.net/6.2/client-api/session/querying/how-to-query.nodejs.md)
- [Full-text search](https://docs.ravendb.net/6.2/client-api/session/querying/text-search/full-text-search.nodejs.md)
- [Querying: Basics](https://docs.ravendb.net/6.2/indexes/querying/query-index.nodejs.md)
