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

Reply via email to