textSearch method
PostgrestFilterBuilder<T>
textSearch(
- String column,
- String query, {
- String? config,
- 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'));
}