path index is recognized by cts:path-reference when xpath contains namespace prefix

最后都变了- 提交于 2019-12-12 05:15:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!