Skip to main content

Fuzzy Search

  • 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.

  • Fuzzy search is available only via DocumentQuery or RQL.

  • Use the Fuzzy method when querying with WhereEquals.

  • In this page:

Fuzzy search example

List<Company> companies = session.Advanced
.DocumentQuery<Company>()
// Query with a term that is misspelled
.WhereEquals(x => x.Name, "Ernts Hnadel")
// Call 'Fuzzy'
// Pass the required similarity, a decimal param between 0.0 and 1.0
.Fuzzy(0.5m)
.ToList();

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

Syntax

IDocumentQuery<T> Fuzzy(decimal fuzzy);
ParameterTypeDescription
fuzzydecimalA value between 0.0 and 1.0.
With a value closer to 1.0, terms with a higher similarity will be matched.