Similarity search with the tsearch2 extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
I want to realize a Full Text Search with the tsearch2 extension. It should find similar sentences.
 
I used my own trigger to store the tsvector of the sentences and I created a usual gist index on them.
I have to to use many OR statements with a low set of arguments, what heavy damages the performance.
My former query looked like this:
 
SELECT strip(to_tsvector('The tiger  is the largest cat species, reaching a total body length of up to 3.3 m  and weighing up to 306 kg.'));
                                           strip                                             
----------------------------------------------------------------------------------------------
 '3.3' '306' 'bodi' 'cat' 'kg' 'largest' 'length' 'm' 'reach' 'speci' 'tiger' 'total' 'weigh'
(1 row)
 
SELECT * FROM tablename WHERE vector @@ to_tsquery('speci & tiger & total & weigh') AND vector @@ to_tsquery('largest & length & m & reach')  AND vector @@ to_tsquery('3.3 & 306 & bodi & cat & kg');

And thats very slow.
Is there a better solution like a functional index?

Thank you for your help.
 
Janek Sendrowski


-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux