问题
If an element exists more than one places in a XML. Then it was difficult to sort the data on a particular element (by default docs will be sorted on the first element).
I was able to solve this problem by defining a path-index
and passing it to cts:path-reference
query.
But if the xpath contains
a namespace prefix(namespace is defined for the xml) then cts:path-reference
is not able to find the defined path-index
.
I am getting the below error.
SEARCH-BADORDERBY: (err:FOER0000) Indexes are required to support element, element-attribute, json-property, or field sort specifications
Not able to understand why I am getting this error. Please help!
回答1:
Some good practices around path indexes:
- Make sure you use the exact same path expression string both when declaring the index, and when using it, including identical prefixes
- Declare the prefixes are path namespaces at the least, optionally at app server level instead
- cts:path-reference takes a third parameter with which you can pass in namespace bindings
HTH!
来源:https://stackoverflow.com/questions/43846322/path-index-is-recognized-by-ctspath-reference-when-xpath-contains-namespace-pre