【发布时间】:2016-04-18 11:20:40
【问题描述】:
我用Xquery 来获取属性值,但是这个查询有点慢。
您能否建议我使用哪个indexing 来加快查询速度?
**Sample Xquery**
//root/root1[@name eq "antony"] /@dept
【问题讨论】:
我用Xquery 来获取属性值,但是这个查询有点慢。
您能否建议我使用哪个indexing 来加快查询速度?
**Sample Xquery**
//root/root1[@name eq "antony"] /@dept
【问题讨论】:
您正在使用//。这将选择路径为/root/root1[@name eq "antony"] /@dept 的树中任意位置的节点。如果可能的话试试/root/root1[@name eq "antony"] /@dept
对于索引,您可以在@name 上放置一个属性范围索引。
【讨论】:
另一个建议是使用cts:search 并通过MarkLogic 创建indexing 到Attribute Range Indexes,而不是使用非常慢的路径。
此外,您可以通过以下方式查询索引:
cts:element-attribute-range-query(xs:QName("root1"), xs:QName("name"), "=", "antony")
【讨论】: