jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clemens Wyss <clemens...@mysign.ch>
Subject RE: JCR-SQL2 : no count when WHERE clause is provided
Date Thu, 30 Sep 2010 15:13:13 GMT
>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:aklimets@day.com]
> Sent: Thursday, September 30, 2010 5:10 PM
> To: users@jackrabbit.apache.org
> Subject: Re: JCR-SQL2 : no count when WHERE clause is provided
>
>
> On Thu, Sep 30, 2010 at 11:55, Clemens Wyss
> <clemensdev@mysign.ch> wrote:
> > Hi all,
> > on the sling mailinglist
> (http://mail-archives.apache.org/mod_mbox/sling-users/201009.m
box/%3C4CA4457A.9010006@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.klimetschek@day.com

Mime
View raw message