3 ms·
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 phr
by manigandham 8y ago
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-combined-with-fuzzysearch-in-postgresql/51433877#51433877 https://stackoverflow.com/questions/46122175/fulltext-search...