## org.exist.storage
Class IndexSpec

    java.lang.Object
      org.exist.storage.IndexSpec

public class IndexSpec
extends java.lang.Object

Top class for index definitions as specified in a collection configuration or the main configuration file. The IndexSpec for a given collection can be retrieved through method `Collection.getIdxConf(DBBroker)`. An index definition should have the following structure:

      <index index-depth="idx-depth">
          <fulltext default="all|none" attributes="true|false">
              <include path="node-path"/>
              <exclude path="node-path"/>
          </fulltext>
          <create path="node-path" type="schema-type">
      </index>

Author:
  wolf

Constructor Summary
`IndexSpec(org.w3c.dom.Element index)`

Method Summary
`FulltextIndexSpec` `getFulltextIndexSpec()` Returns the fulltext index configuration object for the current configuration.
`GeneralRangeIndexSpec` `getIndexByPath(NodePath path)` Returns the `GeneralRangeIndexSpec` defined for the given node path or null if no index has been configured.
`QNameRangeIndexSpec` `getIndexByQName(QName name)`
`int` `getIndexDepth()` Returns the current index depth, i.e.
`void` `read(org.w3c.dom.Element index)` Read index configurations from an "index" element node.
`void` `setIndexDepth(int depth)` Set the current index depth.
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IndexSpec

    public IndexSpec(org.w3c.dom.Element index)
              throws DatabaseConfigurationException

Method Detail

### read

    public void read(org.w3c.dom.Element index)
              throws DatabaseConfigurationException

  Read index configurations from an "index" element node. The node should have exactly one "fulltext" child node and zero or more "create" nodes. The "fulltext" section is forwarded to class `FulltextIndexSpec`. The "create" elements add a `GeneralRangeIndexSpec` to the current configuration.

  Parameters:
    `index` -
  Throws:
    `DatabaseConfigurationException`

### getIndexDepth

    public int getIndexDepth()

  Returns the current index depth, i.e. the level in the tree up to which node ids are added to the B+-tree in the main dom.dbx. Nodes below the current index depth are not added. The main B+-tree is only required when retrieving nodes for display. Usually, it is not necessary to add all node levels there. Nodes in lower levels of the tree can be retrieved via their parent nodes.

  Returns:
    Current index depth.

### setIndexDepth

    public void setIndexDepth(int depth)

  Set the current index depth.

  Parameters:
    `depth` - Current index depth
  See Also:
    `getIndexDepth()`

### getFulltextIndexSpec

    public FulltextIndexSpec getFulltextIndexSpec()

  Returns the fulltext index configuration object for the current configuration.

### getIndexByPath

    public GeneralRangeIndexSpec getIndexByPath(NodePath path)

  Returns the `GeneralRangeIndexSpec` defined for the given node path or null if no index has been configured.

  Parameters:
    `path` -

### getIndexByQName

    public QNameRangeIndexSpec getIndexByQName(QName name)

### toString

    public java.lang.String toString()

Copyright (C) Wolfgang Meier. All rights reserved.