XDMP-ELEMRIDXNOTFOUND: cts:element-values --MarkLogic 10中没有元素范围索引[marklogic]

XDMP-ELEMRIDXNOTFOUND: cts:element-values -- No element range index in MarkLogic 10 [marklogic]

我是 MarkLogic 的新手。

我有 XML 文档

<?xml  version="1.0" encoding="UTF-8"?>
<books xmlns="http://www.marklogic.com/ns/gs-books">
<book bookid="2">
<title>A Quick Path to an Application</title>
<author>
<last>Smith</last>
<first>James</first>
</author>
<publisher>Scribblers Press</publisher>
<isbn>1494-3930392-4</isbn>
<abstract>
          This book describes in detail the power of how 
          to use Java to build powerful web applications 
          that are built on the MarkLogic Server platform.
      </abstract>
</book>
</books>

如何使用 cts:element-values 来对抗它?

这是我的尝试:cts:element-values(xs:QName("test"),"test")

它给我这个错误:

[1.0-ml] XDMP-ELEMRIDXNOTFOUND: cts:element-values(fn:QName("","t"), "t") -- No element range index for t collation=http://marklogic.com/collation/ coordinate-system=wgs84 [marklogic]

为了能够使用cts:element-values(),元素需要有对应的range-index才能使用。

Returns values from the specified element value lexicon(s). Value lexicons are implemented using range indexes; consequently this function requires an element range index for each element specified in the function. If there is not a range index configured for each of the specified elements, an exception is thrown.

所以,为了能够运行:cts:element-values(xs:QName("test"),"test")

您首先需要为“test”元素创建一个字符串范围索引(并确保重新索引器已启用,并允许它使用该元素完成对文档的重新索引,以便构建词典)。

您可以在Admin UI, programmatically with admin:database-add-range-element-index(), and if you have an ml-gradle项目中配置一个element-range-index,它们可以添加到数据库配置中。