* <code>SET ATTRINDEX true; SET ATTRINCLUDE id name; CREATE DB factbook.xml</code>: Enable attribute index; only index 'id' and 'name' attributes; create database
With XQuery, index structures can be created and dropped via [[{{Function|Database Module#db:optimize|db:optimize]]}}:
<pre class="brush:xquery">
</pre>
Matching text nodes can be directly requested from the index with the XQuery function [[{{Function|Database Module#db:text|db:text]]}}. The index contents can be accessed via [[{{Function|Index Module#index:texts|index:texts]]text}}.
The {{Option|UPDINDEX}} option can be activated to keep this index up-to-date.
</pre>
Text nodes can directly be retrieved from the index via the XQuery function [[{{Function|Database Module#db:text-range|db:text-range]]}}.
Please note that the current index structures do not support queries for numbers and dates.
</pre>
Attribute nodes can directly be retrieved from the index with the XQuery functions [[{{Function|Database Module#db:attribute|db:attribute]] }} and [[{{Function|Database Module#db:attribute-range|db:attribute-range]]}}. The index contents can be accessed with [[{{Function|Index Module#index:attributes|index:attributes]]}}.
The [[Options#UPDINDEX|UPDINDEX]] option can be activated to keep this index up-to-date.
</pre>
Attributes with tokens can be directly retrieved from the index with the XQuery function [[{{Function|Database Module#db:token|db:token]]}}. The index contents can be accessed with [[{{Function|Index Module#index:tokens|index:tokens]]}}.
==Full-Text Index==
</pre>
Text nodes can be directly requested from the index via the XQuery function [[{{Function|Full-Text Module#ft:search|ft:search]]}}. The index contents can be accessed with [[{{Function|Full-Text Module#ft:tokens|ft:tokens]]}}.
==Selective Indexing==
</pre>
With {{Command|CREATE INDEX}} and [[{{Function|Database Module#db:optimize|db:optimize]]}}, new selective indexing options will ba applied to an existing database.
=Custom Index Structures=