textSearch method

PostgrestFilterBuilder 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.

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

Implementation

PostgrestFilterBuilder 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)';
  appendSearchParams(column, '${typePart}fts$configPart.$query');
  return this;
}