SimilarityLevel Class
Represents an algorithm of the fuzzy search that specifies the similarity level. The similarity level algorithm calculates the maximum number of mistakes for a word as inversely proportional to the word length.
Inheritance Hierarchy

Namespace: GroupDocs.Search.Options
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 20.8
Syntax
public class SimilarityLevel : FuzzyAlgorithm

The SimilarityLevel type exposes the following members.

Constructors
  NameDescription
Public methodSimilarityLevel
Initializes a new instance of the SimilarityLevel class.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetMaxMistakeCount
Gets the maximum allowed number of mistakes for the specified term length.
(Overrides FuzzyAlgorithmGetMaxMistakeCount(Int32).)
Public methodGetSimilarityLevel
Gets the similarity level value for the specified term length.
(Overrides FuzzyAlgorithmGetSimilarityLevel(Int32).)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Remarks
Learn more
Examples
The example demonstrates a typical usage of the class.
C#
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 SimilarityLevel(0.8); // Creating the fuzzy search algorithm
// This function specifies 0 as the maximum number of mistakes for words from 1 to 4 characters.
// It specifies 1 as the maximum number of mistakes for words from 5 to 9 characters.
// It specifies 2 as the maximum number of mistakes for words from 10 to 14 characters. And so on.

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