You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Clemens Wyss <cl...@mysign.ch> on 2010/09/30 11:55:11 UTC

JCR-SQL2 : no count when WHERE clause is provided

Hi all,
on the sling mailinglist (http://mail-archives.apache.org/mod_mbox/sling-users/201009.mbox/%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?

Thx in advance
Clemens

Re: JCR-SQL2 : no count when WHERE clause is provided

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Fri, Oct 1, 2010 at 10:36 AM, Clemens Wyss <cl...@mysign.ch> wrote:
> is this a bug? Should I make a jira entry?

More like a feature of the current SQL2 implementation. Creating an
improvement request in Jira will help address this problem.

BR,

Jukka Zitting

RE: JCR-SQL2 : no count when WHERE clause is provided

Posted by Clemens Wyss <cl...@mysign.ch>.
is this a bug? Should I make a jira entry?

> -----Original Message-----
> From: Clemens Wyss [mailto:clemensdev@mysign.ch]
> Sent: Thursday, September 30, 2010 5:13 PM
> To: 'users@jackrabbit.apache.org'
> Subject: RE: JCR-SQL2 : no count when WHERE clause is provided
>
>
> >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
> > <cl...@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
>

RE: JCR-SQL2 : no count when WHERE clause is provided

Posted by Clemens Wyss <cl...@mysign.ch>.
>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
> <cl...@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

Re: JCR-SQL2 : no count when WHERE clause is provided

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Sep 30, 2010 at 11:55, Clemens Wyss <cl...@mysign.ch> wrote:
> Hi all,
> on the sling mailinglist (http://mail-archives.apache.org/mod_mbox/sling-users/201009.mbox/%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