avoiding XDMP-EXPNTREECACHEFULL and loading document

怎甘沉沦 提交于 2019-12-01 17:06:57

When you want to export large quantities of XML from MarkLogic, the best technique is to write the query so that results can stream, avoiding the expanded tree cache entirely. It is a very different style of coding, though: you'll have to avoid strong typing of any kind, and refactor your code to remove FLWOR expressions. You won't be able to test any of the code in cq or qconsole, either.

Take a look at http://blakeley.com/blogofile/2012/03/19/let-free-style-and-streaming/ for some tips on how to get there. At a minimum the code sample you posted would have to become:

doc(cts:uri-match('products/documents/*.xml'))

In passing I would try to rework that to avoid the *.xml part, because it will be slower than needed. Maybe something like this?

cts:search(
  collection(),
  cts:directory-query('products/documents/', 'infinity'))

If you need to test for something more than the directory, you could add a cts:and-query with some cts:element-query test.

For general information about this error, see the MarkLogic knowledge base article on XDMP-EXPNTREECACHEFULL

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