whereContainsWholeWord method
void
whereContainsWholeWord(})
Powerful search for containing whole words. This search is much quicker than regex and can search for whole words including whether they are case sensitive or not. This search can also order by the score of the search
Implementation
void whereContainsWholeWord(
String column,
String searchTerm, {
bool caseSensitive = false,
bool orderByScore = true,
bool diacriticSensitive = false,
}) {
searchTerm = Uri.encodeComponent(searchTerm);
queries.add(MapEntry<String, dynamic>(_singleQuery,
'"$column":{"\$text":{"\$search":{"\$term": "$searchTerm", "\$caseSensitive": $caseSensitive , "\$diacriticSensitive": $diacriticSensitive }}}'));
if (orderByScore) {
orderByAscending('\$score');
keysToReturn(['\$score']);
}
}