我正在使用下面提到的查询从存储在MarkLogic集合中的XML文件中获取不同的值.集合包含超过40k文件.
执行查询时,结果需要很长时间.有没有更好的方法来优化以下查询或任何其他选项,以便在没有XPath的情况下使用此查询.
XQuery的:
fn:distinct-values(fn:collection(collectionName)//caseml/case[@jur eq in]/@year)
Run Code Online (Sandbox Code Playgroud)
输入XML示例:
<?xml version="1.0" encoding="UTF-8"?>
<caseml>
<case jur="in" series="mlj" volume="1" year="2016" startpage="129">
<p num="y" pnum="22">
<text>
In view of the aforesaid discussion, we find the writ petition completely devoid
of any merit and accordingly, we dismiss the same, leaving the parties to bear their
own costs.
</text>
</p>
</case>
</caseml>
Run Code Online (Sandbox Code Playgroud)
上面的XQuery正在运行,但需要更快地获得结果.