San*_*kar 4 xpath xquery marklogic
我正在使用下面提到的查询从存储在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正在运行,但需要更快地获得结果.
hun*_*ker 10
要在大量文档中快速检查原子值,您需要配置范围索引,该索引指示MarkLogic在索引时提取值并将它们保存在内存驻留数据结构中,以便可以在不触及磁盘的情况下访问它们.由于您需要特定路径上的值,因此您需要配置路径范围索引.重建索引后,您可以使用cts:values
检索值.您可以选择将cts:query
呼叫传递给限制符合某些条件的文档.
归档时间: |
|
查看次数: |
185 次 |
最近记录: |