Method: Sequel::Postgres::DatasetMethods#full_text_search

Defined in:
lib/sequel/adapters/shared/postgres.rb

#full_text_search(cols, terms, opts = OPTS) ⇒ Object

PostgreSQL specific full text search syntax, using tsearch2 (included in 8.3 by default, and available for earlier versions as an add-on).



1178
1179
1180
1181
1182
# File 'lib/sequel/adapters/shared/postgres.rb', line 1178

def full_text_search(cols, terms, opts = OPTS)
  lang = opts[:language] || 'simple'
  terms = terms.join(' | ') if terms.is_a?(Array)
  filter("to_tsvector(?::regconfig, ?) @@ to_tsquery(?::regconfig, ?)", lang, full_text_string_join(cols), lang, terms)
end