jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Stocker <christian.stoc...@liip.ch>
Subject Re: About the missing COUNT() feature in jackrabbit
Date Wed, 04 Apr 2012 06:35:47 GMT
Hi

Any opinions on this? I'm mainly wondering if there's a chance that
something like this goes into jackrabbit or if there's opposition to
that. Not the actual implementation, just the idea of it. I'll work more
on it, if you think that could be something for jackrabbit-jcr-server
and propose something more decent.

If not, I'll pursue other challenges ;)

Greetings

chregu

On 31.03.12 08:18, Christian Stocker wrote:
> Hi
> 
> As we all know, there's no COUNT feature in SQL2. This is not that bad,
> if you're not trying to get a count via remoting, since you can get it
> with .getSize() locally.  But if you're working via the webdav layer,
> it's not really efficient right now, especially if your resultsets are
> larger.
> 
> There are in my opinion 2 opinions to solve this.
> 
> 1) add a count() feature to the SQL2 parser, there's already a ticket
> for that (among other things)
> https://issues.apache.org/jira/browse/JCR-2605
> That of course would be a great solutions, it solves the problem for all
> cases who need that
> 
> 2) add an option to the SEARCH webdav interface to get the count if
> results instead of the whole result set.
> 
> For 2) I made a little prototype (which is really just that ;)) to see
> if that would be feasible. That patch can be found here
> 
> https://github.com/chregu/jackrabbit/compare/count-in-webdav
> 
> It adds a D:count option to a SEARCH query like this
> 
> <D:searchrequest xmlns:D="DAV:">
> 	<JCR-SQL2>
> 		<![CDATA[SELECT * FROM [nt:unstructured] ]]>
> 	</JCR-SQL2>
> 	<D:count>1</D:count>	
> </D:searchrequest>
> 
> and if that is set it returns only the count of results. Currently like
> below, but that format has certainly to be changed (it was just the
> shortest way to get something back):
> 
> <D:multistatus xmlns:D="DAV:">
> 	<D:response>
> 		<D:href>#count</D:href>
> 		<D:responsedescription>433</D:responsedescription>
> 	</D:response>
> <D:responsedescription>nt:unstructured.jcr:primaryType</D:responsedescription>
> </D:multistatus>
> 
> My questions:
> 
> - Is there any chance that something like this goes into jackrabbit and
> we can build on that feature?
> - Or is there a better way to just get the count of a query?
> - How should the response look like for something like this? The above
> is certainly not right ;)
> - And last but not least, are there any plans to implement COUNT() some
> time in the future directly in SQL2?
> 
> Thanks for any feedback.
> 
> chregu
> 
> 

-- 
Liip AG  //  Feldstrasse 133 //  CH-8004 Zurich
Tel +41 43 500 39 81 // Mobile +41 76 561 88 60
www.liip.ch // blog.liip.ch // GnuPG 0x0748D5FE


Mime
View raw message