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

Reply via email to