>only an order by triggers it
that's why I explicitly add the 'order by [jcr:score]' to each query...

> -----Original Message-----
> From: Alexander Klimetschek [mailto:[email protected]]
> Sent: Thursday, September 30, 2010 5:10 PM
> To: [email protected]
> Subject: Re: JCR-SQL2 : no count when WHERE clause is provided
>
>
> On Thu, Sep 30, 2010 at 11:55, Clemens Wyss
> <[email protected]> wrote:
> > Hi all,
> > on the sling mailinglist
> (http://mail-archives.apache.org/mod_mbox/sling-users/201009.m
box/%[email protected]%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
[email protected]

Reply via email to