hi chregu

as far as i am concerned i would feel comfortable with either
solution. however, i am not a query expert and thus i would
like to leave the decision regarding 1) to those working on
the query code base.
on the other hand, i don't see any problem in addressing 2).
just a minor detail that i happen to see: i wouldn't use the
DAV: uri for a custom extension.

the best way to proceed was imo if you would create an jira
issue and attach a patch.

kind regards
angela


On 4/4/12 8:35 AM, Christian Stocker wrote:
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



Reply via email to