How to order and limit a xquery resultset at once?
604754Jun 17 2008 — edited Jun 23 2008Hi, I am trying to do the following:
let $hits := (for $hit in /feature order by $hit/title descending return $hit) return $hits[position() = (1 to 2)]
to get an ordered resultset which can be limited to some hits (paged view in web interface).
But it seems when I limit the results, I get the database internal order.
Calling:
let $hits := (for $hit in /feature order by $hit/@title descending return $hit) return $hits
without limiting the resultset works as expected and returns the elements in the expected order.
Do you have any suggestions how I could get this to work?
Greetings