I have a fulltext index on a table. Is it possible to retrieve the set of terms used in the index (gist
or gin
)? With weights if possible?
To clarify:
If I have the following table:
create table "test" (id integer, thing tsvector);
I then make a GIST index on it:
create index thing_index on test using gist (thing);
Then some data:
insert into test (id, thing)
values (1, 'one'),(2, 'two'), (3, 'three'), (4, 'one'), (5, 'two');
The index thing_index
is going contain the following mapping:
'one' => {1, 4}
'two' => {2, 5}
'three' => {3}
I want to obtain the following response from the index:
'one',
'two',
'three'
Maybe even with rankings:
'one' => 2
'two' => 2
'three' => 1
I know I can do this myself by scanning and building my own index, but I want to get it out of Postgres if possible.