FuzzyOptions class

Options for performing a fuzzy search


FuzzyOptions({int location = 0, int distance = 100, double threshold = 0.6, int maxPatternLength = 32, bool isCaseSensitive = false, Pattern? tokenSeparator, bool findAllMatches = false, int minTokenCharLength = 1, int minMatchCharLength = 1, List<WeightedKey> keys = const [], bool shouldSort = true, SorterFn? sortFn, bool tokenize = false, bool matchAllTokens = false, bool verbose = false, bool shouldNormalize = false})
Instantiate an options object. The keys list requires a positive number (they'll be normalized upon instantiation). If any weight is not positive, throws an ArgumentError.


distance int
Determines how close the match must be to the fuzzy location (specified above). An exact letter match which is 'distance' characters away from the fuzzy location would score as a complete mismatch. A distance of '0' requires the match be at the exact location specified, a threshold of '1000' would require a perfect match to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
findAllMatches bool
When true, the algorithm continues searching to the end of the input even if a perfect match is found before the end of the same input.
hashCode int
The hash code for this object.
no setterinherited
isCaseSensitive bool
Indicates whether comparisons should be case sensitive.
keys List<WeightedKey>
List of weighted getters to properties that will be searched
location int
Approximately where in the text is the pattern expected to be found?
matchAllTokens bool
When true, the result set will only include records that match all tokens. Will only work if tokenize is also true.
maxPatternLength int
Machine word size
minMatchCharLength int
Minimum number of characters that must be matched before a result is considered a match
minTokenCharLength int
Ignore tokens with length smaller than this. Only applicable when tokenize is true.
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldNormalize bool
Wether it should convert accents (diacritics) from strings to latin characters before searching.
shouldSort bool
Whether to sort the result list, by score
sortFn SorterFn
Default sort function
threshold double
At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match (of both letters and location), a threshold of '1.0' would match anything.
tokenize bool
When true, the search algorithm will search individual words and the full string, computing the final score as a function of both. Note that when tokenize is true, the threshold, distance, and location are inconsequential for individual tokens.
tokenSeparator Pattern
Regex used to separate words when searching. Only applicable when tokenize is true.
verbose bool
Will print to the console. Useful for debugging.


copyWith({int? location, int? distance, double? threshold, int? maxPatternLength, bool? isCaseSensitive, Pattern? tokenSeparator, bool? findAllMatches, int? minTokenCharLength, int? minMatchCharLength, List<WeightedKey>? keys, bool? shouldSort, SorterFn? sortFn, bool? tokenize, bool? matchAllTokens, bool? verbose, bool? shouldNormalize}) FuzzyOptions
Copy these options with some modifications.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.