exist-db - 如何为 exist-db 中的属性创建索引

标签 exist-db

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

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

我知道我必须在我的 exist-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"/>

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

<server>
  <formal>
    <lastimage>
      <harvested>
        <coverages>
          <coverage active="true" id="EUDEM">
          ...
          </coverage>
        </coverages>
      </harvested>
    </lastimage>
  </formal>
</server>

我不认为添加

<create qname="id" type="xs:string"/>

足够了。

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

最佳答案

你很接近!只需将 @ 添加到 qname 属性的开头即可:

 <create qname="@id" type="xs:string"/>

文档的相关部分是 Configuration by path vs. configuration by qname :

Attributes are specified by @attributeName, so if the attribute is called "attrib1", one uses @attrib1 in the index specification.

关于exist-db - 如何为 exist-db 中的属性创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20567005/

相关文章:

rest - 如何通过 eXist-db 的 REST api 传递 xquery?

java - 如何解决 Nexus 无法从现有数据库的添加存储库中找到 Artifact 的问题?

jquery - XMLHttpRequest 无法加载 http ://localhost:8080/exist/rest/db/. ... Access-Control-Allow-Origin 不允许 Origin null

java - eXistDB 5.2.0 版本没有httpclient?

linux - 使用 RestXQ 服务打开的文件过多

module - 存在 : is it possible to have XQuery modules stored in XML files?

apache - 如何在 Apache 中正确配置 VirtualHost(用于 eXist-db 应用程序)

exist-db - 在 Linux 中的文件系统上查找存储在 exist-db 中的 XML 文件

lucene - 在启动我想要运行的完整 XQuery 之前,如何验证嵌入在较大 XQuery 中的 Lucene 查询不包含语法错误?