Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.storage
Class NativeValueIndexByQName

    java.lang.Object
      org.exist.storage.NativeValueIndex
          org.exist.storage.NativeValueIndexByQName

All Implemented Interfaces:
  ContentLoadingObserver

public class NativeValueIndexByQName
extends NativeValueIndex
implements ContentLoadingObserver

The new index by QName that will make queries like

    / root [ key = 123 ]

very quick. It is used by an Xquery extension function with this signature :

    qname-index-lookup( $qname as xs:string,
                        $key as xs:string ) as node*

that can be used this way :

    $key := qname-index-lookup( "key", "123")
    $user := $key / parent::root

The way of indexing is the same as current range indices `NativeValueIndex`, except that for each QName like mentioned above, the QName will be stored . Related test: @link org.exist.xquery.test.ValueIndexByQNameTest

Author:
  Jean-Marc Vanel http://jmvanel.free.fr/

Field Summary

Fields inherited from class org.exist.storage.NativeValueIndex
`PROPERTY_INDEX_CASE_SENSITIVE`

Constructor Summary
`NativeValueIndexByQName(DBBroker broker, BFile valuesDb)`

Method Summary
`boolean` | `close()`
`void` | `dropIndex(DocumentImpl doc)` Drop all index entries for the given document.
`void` | `endElement(ElementImpl node, NodePath currentPath, java.lang.String content)`
`NodeSet` | `find(int relation, DocumentSet docs, NodeSet contextSet, ValueIndexKeyFactory value)` find
`Sequence` | `findByQName(QName qname, AtomicValue comparisonCriterium, Sequence contextSequence)` called from the special XQuery function util:qname-index-lookup()
`void` | `removeAttribute(AttrImpl attr, NodePath currentPath, boolean index)`
`void` | `removeElement(ElementImpl node, NodePath currentPath, java.lang.String content)` Mark given Element for removal; added entries are written to the list of pending entries.
`void` | `startElement(ElementImpl node, NodePath currentPath, boolean index)` updates the index type of given node according to the Index By QName config.
`void` | `storeAttribute(AttrImpl node, NodePath currentPath, boolean index)` store and index given attribute
`void` | `storeAttribute(RangeIndexSpec spec, AttrImpl node)` Store the given attribute's value in the value index.
`void` | `storeElement(int xpathType, ElementImpl node, java.lang.String content)` Store the given element's value in the value index.

Methods inherited from class org.exist.storage.NativeValueIndex
`dropIndex, endElement, find, flush, match, match, printStatistics, reindex, remove, scanIndexKeys, setDocument, storeText, sync, toString`

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

Methods inherited from interface org.exist.storage.ContentLoadingObserver
`dropIndex, endElement, flush, reindex, remove, setDocument, storeText, sync`

Constructor Detail

### NativeValueIndexByQName

    public NativeValueIndexByQName(DBBroker broker,
                                   BFile valuesDb)

Method Detail

### storeAttribute

    public void storeAttribute(RangeIndexSpec spec,
                               AttrImpl node)

  Description copied from class: `NativeValueIndex`
  Store the given attribute's value in the value index.

  Overrides:
    `storeAttribute` in class `NativeValueIndex`
  Parameters:
    `spec` - The index specification
    `node` - The attribute
  See Also:
    `NativeValueIndex.storeAttribute(org.exist.storage.RangeIndexSpec, org.exist.dom.AttrImpl)`

### storeAttribute

    public void storeAttribute(AttrImpl node,
                               NodePath currentPath,
                               boolean index)

  Description copied from interface: `ContentLoadingObserver`
  store and index given attribute

  Specified by:
    `storeAttribute` in interface `ContentLoadingObserver`
  Overrides:
    `storeAttribute` in class `NativeValueIndex`

### removeAttribute

    public void removeAttribute(AttrImpl attr,
                                NodePath currentPath,
                                boolean index)

### storeElement

    public void storeElement(int xpathType,
                             ElementImpl node,
                             java.lang.String content)

  Description copied from class: `NativeValueIndex`
  Store the given element's value in the value index.

  Overrides:
    `storeElement` in class `NativeValueIndex`
  Parameters:
    `xpathType` - The value type
    `node` - The element
    `content` - The string representation of the value
  See Also:
    `NativeValueIndex.storeElement(int, org.exist.dom.ElementImpl, java.lang.String)`

### startElement

    public void startElement(ElementImpl node,
                             NodePath currentPath,
                             boolean index)

  updates the index type of given node according to the Index By QName config.

  Specified by:
    `startElement` in interface `ContentLoadingObserver`
  Overrides:
    `startElement` in class `NativeValueIndex`

### endElement

    public void endElement(ElementImpl node,
                           NodePath currentPath,
                           java.lang.String content)

### removeElement

    public void removeElement(ElementImpl node,
                              NodePath currentPath,
                              java.lang.String content)

  Description copied from interface: `ContentLoadingObserver`
  Mark given Element for removal; added entries are written to the list of pending entries. `ContentLoadingObserver.flush()` is called later to flush all pending entries.
  Notes: changed name from storeElement()

  Specified by:
    `removeElement` in interface `ContentLoadingObserver`
  Overrides:
    `removeElement` in class `NativeValueIndex`

### findByQName

    public Sequence findByQName(QName qname,
                                AtomicValue comparisonCriterium,
                                Sequence contextSequence)
                         throws XPathException

  called from the special XQuery function util:qname-index-lookup()

  Throws:
    `XPathException`

### find

    public NodeSet find(int relation,
                        DocumentSet docs,
                        NodeSet contextSet,
                        ValueIndexKeyFactory value)
                 throws TerminatedException

  find

  Parameters:
    `relation` - binary operator used for the comparison
    `value` - right hand comparison value
  Throws:
    `TerminatedException`

### dropIndex

    public void dropIndex(DocumentImpl doc)
                   throws ReadOnlyException

  Description copied from interface: `ContentLoadingObserver`
  Drop all index entries for the given document.

  Specified by:
    `dropIndex` in interface `ContentLoadingObserver`
  Overrides:
    `dropIndex` in class `NativeValueIndex`
  Throws:
    `ReadOnlyException`

### close

    public boolean close()
                  throws DBException

  Overrides:
    `close` in class `NativeValueIndex`
  Throws:
    `DBException`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.