FuzzySearchOptionsFuzzyAlgorithm Property
Gets or sets the fuzzy search algorithm. The currently available fuzzy search algorithms are SimilarityLevel and TableDiscreteFunction. The default value is an instance of SimilarityLevel with a similarity level value of 0.5.

Namespace: GroupDocs.Search.Options
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 21.6
public FuzzyAlgorithm FuzzyAlgorithm { get; set; }

Property Value

Type: FuzzyAlgorithm
The fuzzy search algorithm.
ArgumentNullExceptionThrown when value is null.
The example demonstrates how to set the fuzzy search algorithm.
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
string query = "Einstein";

Index index = new Index(indexFolder); // Creating an index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

SearchOptions options = new SearchOptions();
options.FuzzySearch.Enabled = true; // Enabling the fuzzy search
options.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(1, new Step(5, 2), new Step(8, 3)); // Creating the fuzzy search algorithm
// This function specifies 1 as the maximum number of mistakes for words from 1 to 4 characters.
// It specifies 2 as the maximum number of mistakes for words from 5 to 7 characters.
// It specifies 3 as the maximum number of mistakes for words from 8 and more characters.

SearchResult result = index.Search(query, options); // Search in index
See Also