Sample Header Ad - 728x90

Get partial match from GIN indexed TSVECTOR column

20 votes
1 answer
30598 views
I would like to get results by query this: ~~~pgsql SELECT * FROM ( SELECT id, subject FROM mailboxes WHERE tsv @@ plainto_tsquery('avail') ) AS t1 ORDER BY id DESC; ~~~ This works and return rows with tsv containing *'Available'*. But if I use *'avai'* (truncating '...lable') it does not find anything. Do all queries have to be in dictionary? Can't we just query such letters? I have a table that contains e-mail bodies (content) and I would like to make queries fast as it grows rapidly. Currently, I am using: ... WHERE content ~* 'avail'
Asked by xangr (457 rep)
Dec 12, 2016, 08:18 PM
Last activity: Aug 1, 2023, 06:07 PM