Skip to main content
deleted 187 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar'

In 9.6

9.6+ makes this very easy, you just have to do array_to_tsvector(array)

Pre 9.6

You You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar'

In 9.6

9.6+ makes this very easy, you just have to do array_to_tsvector(array)

Pre 9.6

You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar' You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

deleted 2 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Getting out the "words"words

Getting out the "words"

Getting out the words

added 231 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Now first and foremost, this is FTS. All words in the search string get tokenized as a ts_query. From that point on the original search string is lost. So you don'tYou no longer have the actual word any more,words you have a tokenlexemes -- tokens which hashave been stemmed and normalized.

Getting your array to a ts_query,

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar'

In 9.6

9.6+ makes this very easy, you just have to do array_to_tsvector(array)

Pre 9.6

You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

To get the array to a ts_query, you can do something like this

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar' You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

Highlighting

Getting out the "words"

Now first and foremost, this is FTS. All words in the search string get tokenized as a ts_query. From that point on the original search string is lost. So you don't have the actual word any more, you have a token which has been stemmed and normalized.

To get the array to a ts_query, you can do something like this

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar' You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

Now first and foremost, this is FTS. All words in the search string get tokenized as a ts_query. From that point on the original search string is lost. You no longer have words you have lexemes -- tokens which have been stemmed and normalized.

Getting your array to a ts_query,

Essentially, a ts_query looks like, 'fox' & 'jump' & 'dog' & 'foo' & 'bar'

In 9.6

9.6+ makes this very easy, you just have to do array_to_tsvector(array)

Pre 9.6

You should review plainto_tsquery which does slightly more voodoo to get text to a tsquery, and to_tsquery which assumes the string is already properly formatted.

To get the array to a ts_query, you can do something like this

Highlighting

Getting out the "words"

added 905 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496
Loading
added 905 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496
Loading
Post Undeleted by Evan Carroll
Post Deleted by Evan Carroll
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496
Loading