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.
-
Use the
fuzzy
method when querying withwhere_equals
. -
In this page:
Fuzzy search example
companies = list(
session.advanced.document_query(object_type=Company)
# Query with a term that is misspelled
.where_equals("Name", "Ernts Hhandel")
# Call 'fuzzy'
# Pass the required similarity, a decimal param between 0.0 and 1.0
.fuzzy(0.5)
)
# Running the above query on the Northwind sample data returns document: companies/20-A
# which contains "Ernst Handel" in its Name field.
from "Companies"
where fuzzy(Name = "Ernts Hnadel", 0.5)
Syntax
def fuzzy(self, fuzzy: float) -> DocumentQuery[_T]: ...
Parameter | Type | Description |
---|---|---|
fuzzy | float |
A value between 0.0 and 1.0 .With a value closer to 1.0 , terms with a higher similarity are matched. |
Return Type | Description |
---|---|
DocumentQuery[_T] |
The same object used for the query |