Обсуждение: Word-level bigrams/trigrams in tsvector

Поиск
Список
Период
Сортировка

Word-level bigrams/trigrams in tsvector

От
Alan Li
Дата:
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