FuzzyOptions<T> class
Options for performing a fuzzy search
Constructors
-
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<T> >T> ? 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.
Properties
- 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.
final
- 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.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCaseSensitive → bool
-
Indicates whether comparisons should be case sensitive.
final
-
keys
→ List<
WeightedKey< T> > -
List of weighted getters to properties that will be searched
final
- location → int
-
Approximately where in the text is the pattern expected to be found?
final
- matchAllTokens → bool
-
When true, the result set will only include records that match all tokens. Will only work
if
tokenize
is also true.final - maxPatternLength → int
-
Machine word size
final
- minMatchCharLength → int
-
Minimum number of characters that must be matched before a result is considered a match
final
- minTokenCharLength → int
-
Ignore tokens with length smaller than this. Only applicable when
tokenize
istrue
.final - 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.
final
- shouldSort → bool
-
Whether to sort the result list, by score
final
-
sortFn
→ SorterFn<
T> -
Default sort function
final
- 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.
final
- 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
istrue
, thethreshold
,distance
, andlocation
are inconsequential for individual tokens.final - tokenSeparator → Pattern
-
Regex used to separate words when searching. Only applicable when
tokenize
istrue
.final - verbose → bool
-
Will print to the console. Useful for debugging.
final
Methods
-
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<T> >T> ? sortFn, bool? tokenize, bool? matchAllTokens, bool? verbose, bool? shouldNormalize}) → FuzzyOptions<T> - Copy these options with some modifications.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited