Hi Mike,

Did you try:

order by $doc//sort-date/xs:date(.)

?

Kind regards,
Geert

> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:general-
> [email protected]] Namens Michael Sokolov
> Verzonden: donderdag 12 juli 2012 14:29
> Aan: MarkLogic Developer Discussion
> Onderwerp: [MarkLogic Dev General] sorting by date
>
> I have a date-valued element range index.  I want to use it for
> sorting.  When I do that using an expression like this:
>
> order by xs:date($doc//sort-date)
>
> I get errors when the $doc sequence contains documents that have no
> sort-date.
>
> What is the recommended approach to handling nulls when sorting? Ideally
> we would want them to sort last.
>
> If I just use
>
> order by $doc//sort-date
>
> will the index come in to play?
>
> -Mike Sokolov
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to