如何在exists-db中为属性创建索引

Pan*_*tis 2 exist-db

我正在更新exists-db集合中的XML文件,我必须检查是否存在id以确定是否必须替换或插入文档中的内容.

我注意到随着文件的增长,查询执行时间显着恶化,我决定为我的文件添加一个索引.

我知道我必须在我的exists-db的conf.xml中这样做,因为它在这个例子中显示:

<!-- Range indexes -->
<create qname="title" type="xs:string"/>
<create qname="author" type="xs:string"/>
<create qname="year" type="xs:integer"/>
<!-- "old" context-dependant configuration using the path attribute: -->
<create path="//booktitle" type="xs:string"/>
Run Code Online (Sandbox Code Playgroud)

我想在xml中添加属性id的索引,如下所示:

<server>
  <formal>
    <lastimage>
      <harvested>
        <coverages>
          <coverage active="true" id="EUDEM">
          ...
          </coverage>
        </coverages>
      </harvested>
    </lastimage>
  </formal>
</server>
Run Code Online (Sandbox Code Playgroud)

我认为不会添加

<create qname="id" type="xs:string"/>
Run Code Online (Sandbox Code Playgroud)

足够.

在此属性的exists-db中添加和索引的正确方法是什么?

joe*_*wiz 6

你很亲密!只需将@添加到qname属性的开头:

 <create qname="@id" type="xs:string"/>
Run Code Online (Sandbox Code Playgroud)

文档的相关部分是按路径配置和按qname配置:

属性由@attributeName指定,因此如果属性名为"attrib1",则在索引规范中使用@ attrib1.