whereContainsWholeWord method

void whereContainsWholeWord(
  1. String column,
  2. String query, {
  3. bool caseSensitive = false,
  4. bool orderByScore = true,
  5. bool diacriticSensitive = false,
})

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 query,
    {bool caseSensitive = false,
    bool orderByScore = true,
    bool diacriticSensitive = false}) {
  queries.add(MapEntry<String, dynamic>(_singleQuery,
      '"$column":{"\$text":{"\$search":{"\$term": "$query", "\$caseSensitive": $caseSensitive , "\$diacriticSensitive": $diacriticSensitive }}}'));
  if (orderByScore) {
    orderByAscending('\$score');
    keysToReturn(['\$score']);
  }
}