I am getting -1 on executing getSize() method on rowIterator and nodeIterator object from QueryResult getRows().
In doc it is suggested to use
RangeIterator.getNumberRemaining although no such method exists. I want to get the total number of rows returned by the query. Any inputs are helpful. RangeIterator (Content Repository for Java Technology API Version 2.0)
I am able to get the number of rows using the below snippet:
// iterate over results
QueryResult result = query.execute();
NodeIterator nodes = result.getNodes();
RangeIterator itr = result.getRows();
RangeIterator.getNumberRemaining seems to be a new change proposed in JCR2.0 API.
have u tried using query builder api instead ? using the search result object can help u get the correct number of rows.
Query query = queryBuilder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();