MarkLogic 8 - sort by path indicator

Is sorting by pointer already supported in ML 8? I want to achieve a similar 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 not use only

 <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> 
+6
source share
3 answers

According to docs :

The sort-order element must have one child, one child, one child, or one json-property child.

So you cannot have a child path, but there is a way. Create a field based on the path you want to use, then sort based on that field.

+9
source

There is a schema error in 8.0-1, so the sort order / path pointer is not checked.

However, the code implements support for sort-order / path-index, so if you do not check the parameters, it should work. However, it is best to use the field as Dave suggests, so you can continue to use validation to check for errors.

Schema error fixed in 8.0-2.

+2
source

Yes, create a field in the 'name' element

 <options xmlns="http://marklogic.com/appservices/search"> <sort-order type="xs:string" collation="http://marklogic.com/collation/" direction="ascending"> <field name="name"/> </sort-order> </options> 
+2
source

Source: https://habr.com/ru/post/982488/


All Articles