Gathering word statistics

A full-text search can handle a lot of data. To give end users more insight into their texts, PostgreSQL offers the pg_stat function, which returns a list of words:

SELECT * FROM  ts_stat('SELECT to_tsvector(''english'', comment) 
FROM pg_available_extensions')
ORDER BY 2 DESC
LIMIT 3;
word | ndoc | nentry
----------+------+--------
function | 10 | 10
data | 10 | 10
type | 7 | 7
(3 rows)

The word column contains the stemmed words; ndoc tells us about the number of documents a certain word occurs in. nentry indicates how often a word was found altogether.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset