You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by bilobag <bi...@hotmail.com> on 2007/07/03 16:08:43 UTC

Re: document order related questions

Does anyone know how to order a collection of child nodes by a specific
property from the getNodes() call? or do i have to manually order the nodes
using java?  Please let me know if you have any ideas.  Is there a way to
query just for a parents child nodes and put an order by clause in the
query?



Alexandru Popescu ☀ wrote:
> 
> On 3/31/06, Tobias Bocanegra <to...@day.com> wrote:
>> > Should I read in the above that the document order is in fact the
>> > order in which the child nodes are added? Is this the correct
>> > definition of "document order"?
>> yes, it is the order of nodes you get from a ".getNodes()" call.
>>
> 
> I know that this may look really bad from my side: but what is the
> order of nodes you get from getNodes() call? This is exactly the
> vicious circle I was mentioning in the first mail:
> 
> The document order is the order in which getNodes() returns the
> nodes.... and getNodes() must respect the document order.
> 
> If we agree that document order is the order in which the nodes where
> added, than this vicious circle vanishes, but otherwise it is still
> there.
> 
> Sorry for these questions, but with all my efforts I haven't been able
> to give a good explanation to this and the answers so far are on the
> same initial confusion page I have started with :-(.
> 
> ./alex
> --
> .w( the_mindstorm )p.
> 
>> --
>> -----------------------------------------< tobias.bocanegra@day.com >---
>> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
>> T +41 61 226 98 98, F +41 61 226 98 97
>> -----------------------------------------------< http://www.day.com >---
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/document-order-related-questions-tf1373648.html#a11412915
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.


Re: document order related questions

Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On 7/4/07, Marcel Reutegger <ma...@gmx.net> wrote:
> bilobag wrote:
> > Does anyone know how to order a collection of child nodes by a specific
> > property from the getNodes() call? or do i have to manually order the nodes
> > using java?  Please let me know if you have any ideas.  Is there a way to
> > query just for a parents child nodes and put an order by clause in the
> > query?
>
> sure:
>
> /jcr:root/foo/bar/* order by @prop
>
> but depending on the number of nodes, manually ordering them might be more
> efficient than executing a query.
>

I thought the OP was asking if there is any API that allows:

Node.getNodes(<some_sort_criteria>)

I think the spec covers this in the Ch.4.4: Orderable Child Nodes.

./alex
--
.w( the_mindstorm )p.

> regards
>    marcel
>

Re: document order related questions

Posted by Marcel Reutegger <ma...@gmx.net>.
bilobag wrote:
> Does anyone know how to order a collection of child nodes by a specific
> property from the getNodes() call? or do i have to manually order the nodes
> using java?  Please let me know if you have any ideas.  Is there a way to
> query just for a parents child nodes and put an order by clause in the
> query?

sure:

/jcr:root/foo/bar/* order by @prop

but depending on the number of nodes, manually ordering them might be more
efficient than executing a query.

regards
   marcel