This article is part of the [[Querying|Query Portal]].
It enumerates the index structures available in BaseX.
==Existing Indexes==
<p>Indexes may speed up queries by orders of magnitudes.Currently, four indexes exist:</p>
;Text Index
:This index speeds up text comparisons in predicates.
==Examples of using the indexes==
<p>Here are some examples for queries which are rewritten for index access:</p>
===Text-Based Queries===
*<code>//node()[text() = 'Usability']</code>*<code>//div[p = 'Usability' or p = 'Testing']</code>*<code>path/to/relevant[text() = 'Usability Testing']/and/so/on</code>
===Attribute Index===
*<code>//node()[@align = 'right']</code> *<code>descendant::elem[@id = '1']</code>*<code>range/query[@id >= 1 and @id <= 5]</code>
===Full-Text Index===
*<code>//node[text() contains text 'Usability']</code>*<code>//node[text() contains text 'Usebiliti' using fuzzy]</code> *<code>//book[chapter contains text ('web' ftor 'WWW' using no stemming) ftand 'diversity' using stemming distance at most 5 words]</code>
<p>The [[Full-Text|full-text]] index is optimized to support all features of the XQuery Full TextRecommendation.</p> <p>BaseX extends the specification offering a fuzzy match option.
Fuzzy search is based on the Levenshtein algorithm; the longer
query terms are, the more errors will be tolerated.</p> <p>Default "Case Sensitivity", "Stemming" and "Diacritics" options
will be considered in the index creation. Consequently, all queries
will be sped up which use the default index options.</p>
==Index data structures==
;Full-Text Index (Wildcards enabled)
:A second full-text index is implemented as a compressed trie. It needs slightly more memory than the standard full-text index, but it supports more features, such as full wildcard search.
[[Category:Internal]]
[[Category:XQuery]]