jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Using xpath to return only certain number of results..
Date Thu, 03 May 2007 18:54:29 GMT
Hi Amir,

Amir Mistric wrote:
> Is it possible to specify in xpath expression how many results it should
> return. For example in the query below I get 50+ results but I only want
> first 5...

no, this is not possible, but you can simply drop the remaining results because 
they are lazy loaded anyway.

> /jcr:root/site1/news//element(*,nt:base)[@tag='news' and
> MetaData/@mgnl:template='np-article'] order by @date descending
> I looked into count() and position() but I am not sure how to apply them to
> above query...

jackrabbit has only limited support for position(), however JSR 283 will 
introduce methods to get only a range of a query result. for the time being you 
should use skip() on the iterator and just forget about the remaining results 
that you are not interested in.


View raw message