jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xiaojie Shen <Xiaojie.S...@cybercomgroup.com>
Subject RE: How to use position() in Xpath query
Date Tue, 29 Jun 2010 08:50:08 GMT
The result wasn't limited to 5 when I tried "//element(*, nt:file) [jcr:like(@jcr:createdBy,
'u%')] order by @jcr:created descending limit 5". limit(5) is bad request. Is limit() working
only for sql search or shall I use it in another way?

BR
Shen

-----Original Message-----
From: Michael Coldewey [mailto:post@coldy.de] 
Sent: den 29 juni 2010 10:27
To: dev@jackrabbit.apache.org
Subject: Re: How to use position() in Xpath query


Hello,

as I know, the position() function delivers only the order position in the
list of all childs of the parent node. So it is not 
usefull to limit the results of a query.

To limit the results in a query, you should use the "limit(int)" function
of the resulting query object.

Greetings
Michael




On Tue, 29 Jun 2010 10:08:40 +0200, Xiaojie Shen
<Xiaojie.Shen@cybercomgroup.com> wrote:
> Hi
> 
> I saw an announce in 2007 that position() function doesn't work in
release
> 2.1. Is it the same today?
> 
> If it works now, can somebody explain how to use position() in Xpath
query
> to limit the number of search results? For example, how should it be used
> to the query below?
> String query = "//element(*, nt:file) [jcr:like(@jcr:createdBy, 'u%')]
> order by @jcr:created descending";
> 
> Thanks in advance!
> Shen

Mime
View raw message