I don't want to hijack this thread, but I'm having a similar issue. I'm aware that according to the spec -1 can be returned (for various performance issues) and that's all fine. But I thought you would be able to get the amount of results when the result set count is smaller then the resultFetchSize you can specify for SearchIndex in the repository.xml ?
I've went trough SearchIndex and the QueryResultImpl classes and poked around a bit, but didn't see anything that seems to do this. As previously stated, an order by gives a correct number, but as it is possible that we might have huge datasets at some point, I really don't want to sort them. This is also for doing paging, and we're already doing the "Page 1 of hundreds." thing, but our UI developers are complaining that it should be possible to get a count when they only get a small resultset. Any thoughts ? Regards, Simon On 14 Apr 2010, at 20:42, Alexander Klimetschek wrote: > On Wed, Apr 14, 2010 at 18:58, Gadbury <gadb...@googlemail.com> wrote: >> The order by trick does not always work. > > Did you try "order by @jcr:score descending" (for xpath)? That gives > you the same result as not specifying a sort oder (afaik "stable" in > jackrabbit 2.0) but should provide a count. > > Regards, > Alex > > -- > Alexander Klimetschek > alexander.klimetsc...@day.com