Database Reference
In-Depth Information
•
qname
holds the qualified name (local name with an optional namespace prefix)
of the element or attribute to index. An attribute must be prefixed with an at
sign (
@
).
•
type
contains the data type of the element/attribute to index, expressed as an
XML schema data type. The supported types are
xs:string
,
xs:integer
,
xs:dec
imal
,
xs:boolean
,
xs:dateTime
, and all their subtypes.
If the value of the
type
attribute is invalid, the index configuration
is silently ignored! However, a warning indicating the problem is
written to the
$EXIST_HOME/webapp/WEB-INF/logs/exist.log
logfile.
Indexing Specific Nodes
There is a second format for defining range indexes: using a
path
instead of a
qname
attribute (e.g.,
<create path="//ns1:article/@price" type="xs:double"/>
). The
path
attribute can contain a limited form of XPath expression to specify the nodes to
index; only element and attribute (with
@
) names, the
//
and
/
axes, and the wildcard
*
operator are allowed. Predicates are not allowed.
At first sight, this looks like it's leading to more efficient indexes as you provide the
indexer with a more targeted set of elements/attributes to index, which should in turn
lead to smaller and therefore faster indexes.
Unfortunately, these kinds of indexes make life extremely hard for the query opti‐
mizer. An index like this is only valid in certain contexts, and since optimization is
done at compile time, when the context is frequently not yet known, most optimiza‐
tion techniques cannot be applied.
Therefore, our strong advice is to stick to range indexes based on qualified names and
not use context-dependent indexing. In most cases, the indexes will be larger but the
queries will still be faster!
Range indexing is done on the text values of the defined nodes. For example, assume
you have a range index defined on
title
elements and the XML contains:
<title>
Books written by
<author>
Joe Dumb
</author></title>
The
title
range index will be on the concatenated text nodes of
title
,
"Books writ
ten by Joe Dumb"
.
Range indexes are on the defined node only, though, not on their children. This
means that in the preceding example there is no index on the
author
element.
Search WWH ::
Custom Search