简体   繁体   English

XQuery MarkLogic中的循环超时

[英]Timeout for a loop in XQuery MarkLogic

I have a big collection of about 1 million documents, in MarkLogic (version 9), with below structure: 我在MarkLogic(版本9)中收集了大约100万份文档,其结构如下:

<File>
    <Id></Id>
    <ModifiedAt></ModifiedAt>
    <Author></Author>
    <Title></Title>
</File>

And I need to iterate through entire collection and to replace space from ModifiedAt with T for all documents 我需要遍历整个集合并用ModifiedAt替换所有文档的空间

Example of document: 文件示例:

     <File>
         <Id>12121</Id>
         <ModifiedAt>2011-06-08 14:29:29.000</ModifiedAt>
         <Author>Test</Author>
         <Title>Test</Title>
    </File>

Field ModifiedAt should become: 2011-06-08T14:29:29.000 Field ModifiedAt应该成为:2011-06-08T14:29:29.000

The code looks like: 代码如下:

for $doc in fn:collection('File')
    return xdmp:node-replace($doc/File/ModifiedAt,<ModifiedAt>{fn:replace($doc/File/ModifiedAt,' ','T')}</ModifiedAt>)

The issue is that this code returns timeout. 问题是此代码返回超时。

I assume there is a more elegant way to make this modification on entire collection and maybe someone has a hint. 我假设有一种更优雅的方式对整个集合进行修改,也许有人有提示。

Thank you! 谢谢!

There are various external tools out there, like Corb2 , and MLCP that can be used for this, but you can also do adhoc or less adhoc work from inside MarkLogic. 有各种各样的外部工具,如Corb2和可用于此的MLCP ,但您也可以从MarkLogic内部完成特殊工作或较少的特殊工作。 All you essentially need to do is do your processing in batches. 您基本上需要做的就是批量处理。 Taskbot is very useful for that: Taskbot非常有用:

https://github.com/mblakele/taskbot https://github.com/mblakele/taskbot

HTH! HTH!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM