|
|
|
|
|
by alexpeattie
3752 days ago
|
|
I thought this was a great article, and trigram indexes are definitely an amazing tool to have in the arsenal. I think PostgreSQL fulltext search (with tsvector, tsquery etc.) is given an unfairly bad rap though. I'm not sure that "full text search works best when the text vectors are stored in physical columns with an index" is true - in my experience there's no performance penalty to just indexing the tsvector expression - no need to worry about additional columns or triggers. I also think the assertion that the key problem is that "full text search is that words are broken up according to the rules defined by the language of the text" is very context-dependent. In many situations that's the most awesome feature of fulltext search. Usually when I search for "cat" I'm not interested in results for catacombs or categories, but when I search for restaurants, results matching restaurant (singular) are relevant too. I definitely see that for a use-case like GitLab's, where the data includes code, full text search's stemming would be a hindrance rather than a help. |
|
I'm not sure how easy it would be to ensure that the index would get picked up if searching on a weighted field with multiple columns specified or if it would require that the program know in advance what those columns were. Would the order matter for the index to be used?
Additionally, a column can also easily included relevant search data from related records in other tables or even datasources if desired.