"Tom Lane" <tgl@sss.pgh.pa.us> writes:
> Gregory Stark <stark@enterprisedb.com> writes:
>> The two-argument form may not be actively broken but it sounds not very
>> integrated. Passing a string which is then planned as an SQL query is not very
>> SQL-ish.
>
> True. I'll bet you don't like ts_stat() either.
It seems the right way interface here wouldn't be too different from what's
there. All we need is a SRF which takes a single tsvector and returns the set
of words from it.
Then you could do the aggregates yourself in SQL:
SELECT count(distinct apodid) as ndoc, count(*) as nentry, element FROM ( SELECT apodid, ts_elements(vector)
ASelement FROM apod
) GROUP BY element
-- Gregory Stark EnterpriseDB http://www.enterprisedb.com