2 ms·
I'd argue that isn't a problem with the feature, but a thoughtless implementation. A good implementation will weigh verbatim results highest before considering
by Someone1234 5y ago
I'd argue that isn't a problem with the feature, but a thoughtless implementation.
A good implementation will weigh verbatim results highest before considering the stop-word stripped or stemmed version. Configuring to_tsvector() to not strip stop words or using a stemming dictionary is, in my opinion, a little clunky in Postgres: You'll want to make a new [language] dictionary and then call to_tsvector() using your new dictionary as the first parameter.
After you've set up the dictionary globally, this would look something like:
setweight(to_tsvector('english_no_stem_stop', col), 'A') ||
setweight(to_tsvector('english', col), 'B'))
I think blaming Postgres for adding stemming/stop-word support because it can be [ab]used for a poor search user experience is like blaming a hammer for a poorly built home. It is just a tool, it can be used for good or evil.
PS - You can do a verbatim search without using to_tsvector(), but that cannot be easily passed into setweight() and you cannot use features like ts_rank().