FullTextSearch<T> constructor
This constructor applies default scoring, but also allows you to add additional scoring rules
Matches items in an array with user-provided search string. The input is split into multiple terms, and there is an option
to ensure that each term is matched within the tokens.
term
The search term. Will be tokenized internally
items
The list of items to search against
isMatchAll
Whether or not we should enforce that all terms in term
are matched. eg. term="Eric Martineau" should match on "Eric" AND "Martineau"
isStartsWith
Whether the search will require the search term to match the beginning of the value token or not
ignoreCase
Whether to ignore case when searching
limit
The number of results to return
tokenize
Determines how each item in items
should produce searchable tokens
additionalScorers
Other scorers to use in addition to the defaults
Implementation
FullTextSearch({
required String term,
required Iterable<T> items,
bool isMatchAll = false,
bool isStartsWith = true,
bool ignoreCase = true,
int? limit,
required Tokenizer<T> tokenize,
List<SearchScoring>? additionalScorers,
List<TermMatcher>? additionalMatchers,
}) : this._(
term,
Stream.fromIterable(items),
isMatchAll,
isStartsWith,
ignoreCase,
limit,
tokenize,
[..._defaultScoring, ...?additionalScorers],
[..._defaultMatchers, ...?additionalMatchers]);