TextAnalyzer<T> class
abstract
Abstract base class for text analyzers used in IndexedBox for tokenization.
Subclasses implement different tokenization strategies for full-text search. Use TextAnalyzer.basic, TextAnalyzer.prefix, or TextAnalyzer.ngram to create analyzers.
Example:
final analyzer = TextAnalyzer.prefix((article) => article.title);
Constructors
- TextAnalyzer()
-
Const constructor for subclasses.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
analyze(
T value) → Iterable< String> -
Returns the set of tokens for the given
value. -
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
Static Methods
-
basic<
T> (String searchableText(T)) → TextAnalyzer< T> -
Creates a
BasicTextAnalyzerfor the givensearchableTextextractor. -
ngram<
T> (String searchableText(T), {int minN = 2, int maxN = 6}) → TextAnalyzer< T> -
Creates a
NGramTextAnalyzerfor the givensearchableTextextractor. -
normalize(
String q) → Iterable< String> - Normalizes a string for tokenization:
-
prefix<
T> (String searchableText(T), {int minPrefix = 2, int maxPrefix = 9}) → TextAnalyzer< T> -
Creates a
PrefixTextAnalyzerfor the givensearchableTextextractor.