I have an element DateTimeList with PathRangeIndex for its first child element as follows:
/ResultPage/DateTimeList/DateTime[1]
Usually we sort an element with attribute as follows:
<sort-order type="xs:string" direction="ascending">
<element ns="" name="div"/>
<attribute ns="" name="order"/>
</sort-order>
Is there any similar way to sort DateTimeList element, using its first child element (using the path-range-index). I tried as follows:
<sort-order direction="ascending" type="xs:dateTime">
<path-index>/ResultPage/DateTimeList/DateTime[1]</path-index>
</sort-order><sort-order><score/></sort-order></state></operator>
But got the result with no change as follows:
<DateTimeList>
<DateTime>2014-05-07T10:26:00</DateTime>
</DateTimeList>
<DateTimeList>
<DateTime>2013-12-01T00:00:00</DateTime>
<DateTime>2014-05-01T00:00:00</DateTime>
<DateTime>2014-12-01T00:00:00</DateTime>
</DateTimeList>
<DateTimeList>
<DateTime>2013-09-01T10:32:42</DateTime>
</DateTimeList>
<DateTimeList>
<DateTime>2014-05-30T00:00:00</DateTime>
<DateTime>2015-05-30T00:00:00</DateTime>
</DateTimeList >
Thanks.
The current releases of MarkLogic Search API
actually don't support sorting by path-index. However you have constructed an expression that will work once that support is in the product. There are plans to introduce it.
I'd recommend using search:check-options($options)
to see whether or not your options are valid. I believe in this case check-options will report that the node is not valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With