Word-level bigrams/trigrams in tsvector

From: Alan Li <alanwli(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Word-level bigrams/trigrams in tsvector
Date: 2013-04-17 21:46:00
Message-ID: CAHw2fqgVthKZ7OfTwqNOn1huJpVbgjHB=y5L-RD+cbk+qykivg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm wondering how I can store word-level bigrams/trigrams in a tsvector
that I can query against. I was expecting the final query to match "the
air" and return the one tuple to me.

For instance:

postgres=# create table docs (a tsvector);
CREATE TABLE
postgres=# insert into docs (a) values (strip('''the air'' smells ''sea
water'''::tsvector));
INSERT 0 1
postgres=# select * from docs;
a
--------------------------------
'sea water' 'smells' 'the air'
(1 row)

postgres=# select * from docs where a @@ to_tsquery('''the air''');
a
---
(0 rows)

Thanks, Alan

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-04-17 22:17:33 Re: [GENERAL] currval and DISCARD ALL
Previous Message Ants Aasma 2013-04-17 21:44:02 Re: Enabling Checksums