Re: Tsearch2 - list of words or phrase with count

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Michal Hlavac <hlavki(at)medium13(dot)sk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Tsearch2 - list of words or phrase with count
Date: 2004-07-22 09:32:10
Message-ID: Pine.GSO.4.58.0407221330430.29036@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michal,

check stat() function.
http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_Notes

apod=# select * from stat('select ti from apod') order by ndoc desc, nentry\
apod=# desc,word limit 10;
word | ndoc | nentry
--------+------+--------
year | 1283 | 2064
star | 1273 | 3908
imag | 1267 | 1967
light | 1232 | 2206
pictur | 1177 | 1442
earth | 1059 | 1798
visibl | 992 | 1259
bright | 936 | 1335
котор | 903 | 1441
эт | 879 | 1397

Oleg
On Thu, 22 Jul 2004, Michal Hlavac wrote:

> hello,
>
> I have table with text attribute and fulltext index...
>
> is it possible to do query with result:
>
> word or phrase, count
>
> for example:
> SELECT word, my_count(word) FROM table WHERE expression.
>
> word | my_count
> ----------|------------
> 'hello' | 3
> 'bye' | 4
> 'yellow' | 1
> 'blue' | 5
>
> thanx, hlavki
>
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Schuchardt 2004-07-22 09:40:30 Re: Table access method not behaving like Oracle (index vs sequential
Previous Message Michal Hlavac 2004-07-22 08:02:19 Tsearch2 - list of words or phrase with count