Hi,

I believe the JCR API specification allows to return -1 in all cases. The
specification doesn't say -1 must not be returned if you use "order by".
If you relied on that, then you have relied on an implementation detail.

> Why I need to know the count is irrelevant.

Ehm, no, not to me. I'd like to understand the use case.

Regards,
Thomas




On 24/07/14 12:50, "Torgeir Veimo" <[email protected]> wrote:

>Previously, one could do a
>
>long totalCount = it.getSize();
>
>Do you mean I need to do a
>
>NodeIterator it = res.getNodes(); long totalCount = 0;
>while (it.hasNext()) {
>  Node node = it.nextNode(); totalCount++;
>}
>
>Why I need to know the count is irrelevant. I don't think it's up to
>the persistence layer to dictate policy for the user interface.
>
>On 21 July 2014 20:39, Thomas Mueller <[email protected]> wrote:
>> Hi,
>>
>> You would need to traverse the result. Which is a bad idea if the result
>> is big.
>>
>> The question is: why do you need to know? Do you want to display a page
>> number ("page 1 of 145")? I think that's not a good idea, for multiple
>> reasons.
>>
>> Regards,
>> Thomas
>>
>> On 16/07/14 19:32, "Torgeir Veimo" <[email protected]> wrote:
>>
>>>What's the correct approach to getting a total count from a query
>>>result with apache oak?
>>>
>>>Using 'order by @jcr:score' doesn't seem to work as it does with
>>>Jackrabbit.
>>>
>>>--
>>>-Tor
>>
>
>
>
>-- 
>-Tor

Reply via email to