我有一个使用 Roxy 配置的 Marklogic 9 项目。我一直在关注这些例子:https ://github.com/marklogic-community/roxy/wiki/Adding-Custom-Build-Steps
基本上,我有一个服务器端 JS 函数,我想在部署内容后调用它。我有这样的事情:
# 然后你会定义你的新方法
def deploy_content
# you can optionally call the original
original_deploy_content
# do your stuff here
execute_query(%Q{
xquery version "1.0-ml";
xdmp:javascript-eval('var process = require("/ingestion/process.sjs"); process.postDeployContent();')
},
:db_name => @properties["ml.app-name"] + "-content")
end
通过查询控制台执行时,此处调用的 xquery 评估良好。但是当我调用 ml local deploy content 时,我收到以下错误:
ERROR: 500 "Internal Server Error"
ERROR: <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>500 Internal Server Error</title>
<meta name="robots" content="noindex,nofollow"/>
<link rel="stylesheet" href="/error.css"/>
</head>
<body>
<span class="error">
<h1>500 Internal Server Error</h1>
<dl>
<dt>XDMP-MODNOTFOUND: var process = require("/ingestion/process.sjs"); process.postDeployContent(); -- Module /ingestion/process.sjs not found</dt>
<dd></dd>
<dt>in [anonymous], at 1:14 [javascript]</dt>
<dd></dd>
<dt>at 3:6,
in xdmp:eval("var process = require(&quot;/ingestion/process.sjs&quot;); proce...") [javascript]</dt>
<dd></dd>
<dt>in /eval, at 3:6 [1.0-ml]</dt>
<dd></dd>
</dl>
</span>
</body>
</html>
为什么从 app_specific.rb 通过 xquery 运行时找不到模块?
或者......有没有更好的方法从这里调用 JS 模块函数。对不起,我对xquery方面不太熟悉,所以我只是调用了一个JS函数。