jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergiy Shyrkov <my.public.mail...@gmail.com>
Subject Jackrabbit 2.0 QueryResult.getNodes().getSize() returning -1
Date Thu, 18 Feb 2010 14:12:27 GMT
Hello,

I recently noticed strange behaviour with the size of query results 
(using Jackrabbit 2.0.0).

In the following example:

Query query = ...;
NodeIterator ni = query.execute().getNodes()
if (ni.hasNext()) {
    long count = ni.getSize();
  ...
}

I always get -1 as the size of an non-empty iterator (I can perfectly 
iterate over it and get nodes).

Could you, please, help me understand what am I doing wrong?
I saw that behind the scenes the iterator is initialized lazily 
(LazyScoreNodeIteratorImpl), but even in that case I do not expect 
getSize() to return -1.

Thank you for any hint in advance!

Kind regards
Sergiy Shyrkov

Mime
View raw message