我正在尝试调试一个MarkLogic管道,每次我更改管道使用的一个xquery文件时,我都必须运行一个自制的脚本,它会重新加载所有系统模块。我猜这是在项目只有几个模块时开发的一种技术,但现在这个过程需要几分钟。我需要的是1)一种更快的技术来重新加载我更改过的模块,例如我可以在CQ中运行的代码片段,或者2)一些完全不同的方法。谢谢。
发布于 2011-12-07 03:33:43
通常情况下,你可以直接从文件系统运行你的代码,但这不适用于管道。
第二个最简单的方法就是使用webdav应用服务器和支持webdav的编辑器(如oXygen)。您需要做的就是创建一个新的webdav类型的应用程序服务器,将其连接到您想要访问的模块数据库,确保您有一个用于登录的帐户,并且您已经准备好了。
其他方法是使用更智能的系统,只上传更改过的文件。Ant通常非常擅长检测变化。github ( https://github.com/garyvidal/marklogic-ant-tasks )上也提供了MarkLogic ant任务。虽然不确定这是否真的能更好地工作,但你必须尝试一下。你可能需要好好考虑一下你的构建脚本。我上次使用它的时候,它工作得相当好,当然不是几分钟,即使它加载了几百个文件,如果我没有弄错的话。
然而,你使用的方法如此缓慢,可能有不同的原因。如果你能够公开它,你可以要求具体的优化技巧。
发布于 2011-12-07 04:49:26
我对需要重新加载“所有系统模块”感到有点困惑。也许你应该尝试最新的服务器版本,或者咨询支持人员?
但是假设您只是想重新加载您自己的代码,您可以使用RecordLoader:https://github.com/marklogic/recordloader
如果你更喜欢使用cq,你可以从http://developer.marklogic.com/pubs/4.2/apidocs/AdminBuiltins.html#xdmp:filesystem-directory开始-这可能会让你开始。您可能需要向doc-insert调用添加文档权限,并且可能需要执行更多的字符串操作来构建URI。
declare namespace dir="http://marklogic.com/xdmp/directory";
if (xdmp:database('Modules') eq xdmp:database()) then ()
else error(
(), 'INSTALL-NOTMODULES', text {
xdmp:database-name(xdmp:database()), 'is not the Modules database' })
,
for $i in xdmp:filesystem-directory('/path/to/files')/dir:entry
[dir:type eq 'file']
[ends-with(dir:filename, '.xqy')]
let $uri := $i/filename/string()
return xdmp:document-insert($uri, xdmp:document-get($i/dir:pathname))发布于 2011-12-07 22:47:05
使用Marklogic Ant任务中的技术和XCC连接(任何连接都不必指向您的数据库):https://github.com/garyvidal/marklogic-ant-tasks
您可以在模板中使用以下内容:
<!--Define ml namespace in project root element-->
<project name="ML Build Task" xmlns:ml="http://www.marklogic.com/ant">
>
<!--Set you the classpath to where your mlant.jar file is located.
Include any other dependent jar files required to execute tasks
noted in Dependencies section.
-->
<path id="mlant-classpath">
<fileset dir="${lib-dir}">
<include name="xcc.jar" />
<include name="mlant.jar" />
<include name="corb.jar"/>
<include name="saxon9he.jar"/>
<include name="xqdoc-ml.jar"/>
<include name="antlr-2.7.5.jar"/>
</fileset>
</path>
<!--
Setup the type definition and assign classpathref to mlant-classpath
-->
<typedef
uri="http://www.marklogic.com/ant"
resource="com/marklogic/ant/antlib.xml"
classpathref="mlant-classpath"
/>
<!--Optional: Set the property for xccstring used to connect to MarkLogic database-->
<property name="xccstring" value="xcc://test:test@localhost:9090/Docs">
<!--Create a target element and use the tasks-->
<target name="load-modified">
<ml:load xccurl="${xccstring}">
<ml:docset destdir="/app-code/">
<ml:permissionset>
<ml:permission role="nobody" permission="execute" />
<ml:permission role="nobody" permission="insert" />
<ml:permission role="nobody" permission="read" />
<ml:permission role="nobody" permission="update" />
</ml:permissionset>
<ml:collectionset>
<ml:collection name="collection1" />
<ml:collection name="collection2" />
</ml:collectionset>
<fileset dir="../src" includes="**/*" >
<modified/>
</fileset>
</ml:docset>
</ml:load>
</target>
<!--Have Fun-->
</project>https://stackoverflow.com/questions/8405456
复制相似问题