Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorting rises an error if there is no key 'sorting' #61

Open
emchateau opened this issue Mar 11, 2015 · 1 comment
Open

sorting rises an error if there is no key 'sorting' #61

emchateau opened this issue Mar 11, 2015 · 1 comment
Labels

Comments

@emchateau
Copy link
Contributor

The current sorting mechanism rise an error when there is no key 'sorting' in the request.

for $content in $contents
  order by (: @see http://jaketrent.com/post/xquery-dynamic-order/ :)
    if ($order = 'descending') then map:get($content, $sorting) else () ascending,
    if ($order = 'descending') then () else map:get($content, $sorting) descending

as the dynamic sorting can be tricky, how to solve it ?

see http://en.wikibooks.org/wiki/XQuery/Searching,Paging_and_Sorting

@emchateau emchateau added the bug label Mar 11, 2015
@emchateau
Copy link
Contributor Author

Waiting a nicer solution, could be solved with the following

let $sorting := if (map:get($queryParams, 'sorting')) 
    then map:get($queryParams, 'sorting') 
    else ''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant