News for hackers. Stuff that matters.
Re:Setting Up a Fast, Comprehensive Search Routine with Post... by manigandham on Sunday July 29, 2018 @04:08PM (#17640010)
It's important to note that a simple to_tsquery(...) will not handle phrases, or prefixes, or even normalizing the input. There are plainto_tsquery(...) and phraseto_tsquery(...) methods but these don't have the same flexibility and also won't do prefixes.

If you want some normalization and prefix abilities, you can actually call to_tsvector(...) on your query input, then stitch that together into a better tsquery input.

   SELECT STRING_AGG(lexeme || ':*', ' & ') 
   FROM UNNEST(to_tsvector('testing 123'))
This will return `123:* & test:*` which can then be used for searching. Full example here: https://stackoverflow.com/questions/46122175/fulltext-search...

There are no comments on this comment yet.