xml – 如何对路径范围索引元素进行排序?

前端之家收集整理的这篇文章主要介绍了xml – 如何对路径范围索引元素进行排序?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个元素DateTimeList与PathRangeIndex的第一个子元素,如下所示:

/ResultPage/DateTimeList/DateTime[1]

通常我们用属性对元素进行排序,如下所示:

<sort-order type="xs:string" direction="ascending">
    <element ns="" name="div"/>
    <attribute ns="" name="order"/>
</sort-order>

是否有任何类似的方法来使用其第一个子元素(使用path-range-index)对DateTimeList元素进行排序.我尝试如下:

<sort-order direction="ascending" type="xs:dateTime">
   <path-index>/ResultPage/DateTimeList/DateTime[1]</path-index>
</sort-order><sort-order><score/></sort-order></state></operator>

但得到的结果没有变化如下:

<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 >

谢谢.

解决方法

MarkLogic Search API的当前版本实际上不支持按路径索引进行排序.但是,您构建了一个表达式,只要产品中有该支持,它就会起作用.有计划介绍它.

我建议使用search:check-options($options)来查看您的选项是否有效.我相信在这种情况下,check-options将报告该节点无效.

猜你在找的XML相关文章