textSearch method

PostgrestFilterBuilder<T> textSearch(
  1. String column,
  2. String query, {
  3. String? config,
  4. TextSearchType? type,
})

Finds all rows whose text or tsvector value on the stated column matches the tsquery in query.

await supabase
    .from('users')
    .select()
    .textSearch('catchphrase', "'fat' & 'cat'", config: 'english');

Implementation

PostgrestFilterBuilder<T> textSearch(
  String column,
  String query, {
  /// The text search configuration to use.
  String? config,

  /// The type of tsquery conversion to use on [query].
  TextSearchType? type,
}) {
  var typePart = '';
  if (type == TextSearchType.plain) {
    typePart = 'pl';
  } else if (type == TextSearchType.phrase) {
    typePart = 'ph';
  } else if (type == TextSearchType.websearch) {
    typePart = 'w';
  }
  final configPart = config == null ? '' : '($config)';
  return copyWithUrl(
      appendSearchParams(column, '${typePart}fts$configPart.$query'));
}