Skip site navigation (1) Skip section navigation (2)

Re: TS: Limited cover density ranking

From: karavelov(at)mail(dot)bg
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: TS: Limited cover density ranking
Date: 2012-01-27 17:01:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
----- Цитат от karavelov(at)mail(dot)bg, на 27.01.2012 в 18:48 -----

> ----- Цитат от Sushant Sinha (sushant354(at)gmail(dot)com), на 27.01.2012 в 18:32 -----
>> The rank counts 1/coversize. So bigger covers will not have much impact
>> anyway. What is the need of the patch?
>> -Sushant.
> If you want to find only combinations of words that are close one to another, with the patch you could use something as:
> WITH a AS (SELECT to_tsvector('a b c d e g h i j k') AS vec, to_tsquery('a&d') AS query) 
> SELECT * FROM a WHERE vec @@ query AND ts_rank_cd(3,vec,query)>0;

Another example, if you want to match 'b c d' only, you could use:

WITH A AS (SELECT to_tsvector('a b c d e g h i j k') AS vec, to_tsquery('b&c&d') AS query) 
SELECT * FROM A WHERE vec @@ query AND ts_rank_cd(2,vec,query)>0;

The catch is that it will match also 'b d c', 'd c b', 'd b c', 'c d b' and 'd b d', so it is not a
replacement for exact phrase match but something that I find useful

Luben Karavelov

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-01-27 17:14:38
Subject: Re: pg_statistic, lack of documentation
Previous:From: Heikki LinnakangasDate: 2012-01-27 16:53:11
Subject: Re: patch for parallel pg_dump

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group