On Thu, Sep 30, 2010 at 11:55, Clemens Wyss <clemens...@mysign.ch> wrote: > Hi all, > on the sling mailinglist > (http://mail-archives.apache.org/mod_mbox/sling-users/201009.mbox/%3c4ca4457a.9010...@gmail.com%3e) > we have been discussing the follwoing issue: > > whenever you provide a where-clause to a sql2 select, jcr/jackrabbit does not > provide the hit count. > > E.g.: > select * from [nt:unstructured] > order by [jcr:score] > returns the hit count (query.execute().getRows().getSize()), whereas > select * from [nt:unstructured] > where entity = "customer" > order by [jcr:score] > doesn't. > Is this a bug or a feature?
I am not too familiar with the specific sql2 query implementation, but Nodes/RowIterator.getSize() can return -1 as an optimization (if counting would make the implementation slower). For the classic Xpath/SQL search implementation getSize() returns -1 normally, only an order by triggers it (because it has to load and sort the whole result set anyway). It will be something similar in the sql2 implementation. Regards, Alex -- Alexander Klimetschek alexander.klimetsc...@day.com