MarkLogic 8-按路径索引排序 [英] MarkLogic 8 - sort-order by path-index

查看:39
本文介绍了MarkLogic 8-按路径索引排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ML 8是否已支持按路径索引进行排序?我想实现类似于以下的效果:

Is sort-order by path-index already supported in ML 8? I want to achieve similar to the below:

<options xmlns="http://marklogic.com/appservices/search">
  <sort-order collation="http://marklogic.com/collation/en/S1/EO/CU/MO" type="xs:string" direction="ascending">
    <path-index>attritbutes//name</path-index>
  </sort-order>
</options>

如果没有,是否有办法实现?我有几个名称相同的元素,它们来自不同的父节点或根元素,所以我不能只使用

If not, is there a way to achieve this? I have several elements with the same name from different parent nodes or from the root element so I can't use just

<options xmlns="http://marklogic.com/appservices/search">
  <sort-order collation="http://marklogic.com/collation/en/S1/EO/CU/MO" type="xs:string" direction="ascending">
    <element ns="" name="name"/>
  </sort-order>
</options>

推荐答案

根据 docs :

sort-order元素必须具有单个元素子项,单个分数子项,单个字段子项或单个json属性子项之一.

The sort-order element must have one of a single element child, a single score child, a single field child, or a single json-property child.

因此,您不能有一个路径孩子,但是有一种方法.根据要使用的路径创建一个字段,然后根据该字段进行排序.

So you can't have a path child, but there is a way. Create a field based on the path(s) you want to use, then sort based on that field.

这篇关于MarkLogic 8-按路径索引排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆