Thread: Tsearch2 - list of words or phrase with count

Tsearch2 - list of words or phrase with count

From
Michal Hlavac
Date:
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

--

[ miso hlavac ][ hlavki@medium13.sk ][ http://hlavki.sk ]
[ icq:94900232 ][ callto://hlavki ]

Re: Tsearch2 - list of words or phrase with count

From
Oleg Bartunov
Date:
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@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83