public class SimilarityLevel extends FuzzyAlgorithm
Learn more
The example demonstrates a typical usage of the class.
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.getFuzzySearch().setEnabled(true); // Enabling the fuzzy search
options.getFuzzySearch().setFuzzyAlgorithm(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
core| Modifier | Constructor and Description |
|---|---|
protected |
SimilarityLevel()
Initializes a new instance of the
SimilarityLevel class. |
|
SimilarityLevel(double value)
Initializes a new instance of the
SimilarityLevel class. |
|
SimilarityLevel(Object data)
Initializes a new instance of the
SimilarityLevel class. |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxMistakeCount(int termLength)
Gets the maximum allowed number of mistakes for the specified term length.
|
double |
getSimilarityLevel(int termLength)
Gets the similarity level value for the specified term length.
|
getCoreprotected SimilarityLevel()
SimilarityLevel class.public SimilarityLevel(double value)
SimilarityLevel class.value - The similarity level value.public SimilarityLevel(Object data)
SimilarityLevel class.data - The serialized data.public int getMaxMistakeCount(int termLength)
getMaxMistakeCount in class FuzzyAlgorithmtermLength - The term length.public double getSimilarityLevel(int termLength)
getSimilarityLevel in class FuzzyAlgorithmtermLength - The term length.Copyright © 2026. All rights reserved.