Re: [xwiki-users] I want to sort XWiki Objects with Comparator.

2012-11-14 Thread Jeremie BOUSQUET
This is basically extension of SQL, with same principles, so if in your
where clause you specify the page you want, it won't query the entire
wiki.
For ordering, you just have to specify the field you want in the order by
clause, I don't understand why you would need a Comparator ?

For example, if you have, say, objects of class MyClass attached to page
MySpace.MyPage, and want to get them ordered by field value, you would
do:

select objects.name from Document doc, doc.object(MyClass) as objects where
doc.fullName=MySpace.MyPage order by objects.value asc

Note: I did not test this query, you might have to add the field from the
order by clause to the select clause, as far as I remember.




2012/11/14 crocket crockabisc...@gmail.com

 I succeeded in obtaining ordered XWiki Objects from a specific page with
 XWQL, but it was too slow since it queried the entire wiki.

 Since I just need objects from a specific page, I don't need the overhead
 of querying the entire wiki DB.

 To order objects obtained by $doc.getObjects(Class), it seems I need a
 Comparator class that I can pass to a collection sort method.

 To compare fields, I need to extract types from the fields the Comparator
 is given in its constructor, which I don't have an idea of.

 How do I implement a Comparator that compares objects according to given
 fields?
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] I want to sort XWiki Objects with Comparator.

2012-11-13 Thread gmail


2 iPad my from Sent

On Nov 14, 2012, at 1:57 PM, crocket crockabisc...@gmail.com wrote:

 I succeeded in obtaining ordered XWiki Objects from a specific page with
 XWQL, but it was too slow since it queried the entire wiki.
 
 Since I just need objects from a specific page, I don't need the overhead
 of querying the entire wiki DB.
 
 To order objects obtained by $doc.getObjects(Class), it seems I need a
 Comparator class that I can pass to a collection sort method.
 
 To compare fields, I need to extract types from the fields the Comparator
 is given in its constructor, which I don't have an idea of.
 
 How do I implement a Comparator that compares objects according to given
 fields?
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users