Match a phrase ending in a prefix with full text search

后端 未结 4 976
北恋
北恋 2020-12-31 14:36

I\'m looking for a way to emulate something like SELECT * FROM table WHERE attr LIKE \'%text%\' using a tsvector in PostgreSQL.

I\'ve created a tsvector

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-31 15:03

    There's a way to do it in Postgres using trigrams and Gin/Gist indexes. There's a simple example, but with some rough edges, in this article by Kristo Kaiv: Substring Search.

提交回复
热议问题