[daisy] COUNT in queries
Bruno Dumon
bruno at outerthought.org
Wed Jul 26 11:34:29 CDT 2006
On Wed, 2006-07-26 at 18:18 +0200, Yves Langisch wrote:
> Hi,
>
> Is there an easy way to count the elements of the resultset returned by
> a query? I couldn't find any COUNT function for the query language. My
> current workaround is to read the size in my custom stylesheet from
> <ns:resultInfo size="5" chunkOffset="1" chunkLength="5"/> which is not
> very efficient in case of a big resultset (the whole resultset is in the
> response).
There's no count function (the query language returns always lists of
documents, unlike e.g. SQL).
We'll likely soon look into adding pagination of query results
(currently only present for faceted queries), with this you would be
able to ask a chunk of size '0' to avoid transporting the result set.
In the meantime, some hints for optimalisation:
* don't select any data. However, the query language requires you to
select at least one thing. So you can do e.g. 'select id where...'.
* don't use an order by clause as that won't influence the count
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list