dbXML API

## com.dbxml.db.common.indexers
Class NameIndexer

    java.lang.Object
      com.dbxml.db.common.btree.Paged
          com.dbxml.db.common.btree.BTree
              com.dbxml.db.common.indexers.NameIndexer

All Implemented Interfaces:
  Configurable, Indexer

public final class NameIndexer
extends BTree
implements Indexer

NameIndexer is a basic implementation of the Indexer interface. It is used for maintaining element and element@attribute unique indexes.

Nested Class Summary

Nested classes inherited from class com.dbxml.db.common.btree.Paged
`Paged.FileHeader, Paged.Page, Paged.PageHeader`

Field Summary

Fields inherited from interface com.dbxml.db.core.indexer.Indexer
`STYLE_FULLTEXT, STYLE_NODENAME, STYLE_NODEVALUE`

Constructor Summary
`NameIndexer()`

Method Summary
`void` `add(Transaction tx, java.lang.String value, Key key, int pos, int elemID, int attrID)` add adds a Document to the Indexer.
`java.lang.String` `getIndexStyle()` getIndexStyle returns the Index style.
`java.lang.String` `getName()` getName returns the name of this Indexer.
`java.lang.String` `getPattern()` getPattern returns the pattern recognized by this Indexer.
`IndexMatch[]` `queryMatches(Transaction tx, IndexQuery query)` queryMatches retrieves a set of MatchEntry instances that match the supplied query.
`void` `remove(Transaction tx, java.lang.String value, Key key, int pos, int elemID, int attrID)` remove removes all references to the specified Key from the Indexer.
`void` `setCollection(Collection collection)` setCollection tells the Indexer who its parent is.
`void` `setConfig(Configuration config)` setConfig sets the configuration information for the Configurable object instance.
`void` `setLocation(java.lang.String location)`

Methods inherited from class com.dbxml.db.common.btree.BTree
`addValue, create, createFileHeader, createFileHeader, createFileHeader, createFileHeader, createPageHeader, findValue, open, query, removeValue`

Methods inherited from class com.dbxml.db.common.btree.Paged
`addPageFilter, close, deleteArrayValue, drop, exists, flush, getConfig, getFileHeader, getTransactionLog, insertArrayValue, isOpened, listPageFilters, removePageFilter`

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

Methods inherited from interface com.dbxml.db.core.indexer.Indexer
`close, create, drop, exists, flush, getTransactionLog, isOpened, open`

Methods inherited from interface com.dbxml.util.Configurable
`getConfig`

Constructor Detail

### NameIndexer

    public NameIndexer()

Method Detail

### setConfig

    public void setConfig(Configuration config)
                   throws dbXMLException

  Description copied from interface: `Configurable`
  setConfig sets the configuration information for the Configurable object instance.

  Specified by:
    `setConfig` in interface `Configurable`
  Overrides:
    `setConfig` in class `Paged`
  Throws:
    `dbXMLException`

### getName

    public java.lang.String getName()

  Description copied from interface: `Indexer`
  getName returns the name of this Indexer.

  Specified by:
    `getName` in interface `Indexer`
  Returns:
    the Indexer name

### setLocation

    public void setLocation(java.lang.String location)

### setCollection

    public void setCollection(Collection collection)

  Description copied from interface: `Indexer`
  setCollection tells the Indexer who its parent is.

  Specified by:
    `setCollection` in interface `Indexer`
  Parameters:
    `collection` - The owner Collection

### getIndexStyle

    public java.lang.String getIndexStyle()

  Description copied from interface: `Indexer`
  getIndexStyle returns the Index style. Different query languages will need to draw from different indexing styles. For example, A query that is written in quilt will require XPath indexing.

  Specified by:
    `getIndexStyle` in interface `Indexer`
  Returns:
    The index style

### getPattern

    public java.lang.String getPattern()

  Description copied from interface: `Indexer`
  getPattern returns the pattern recognized by this Indexer. Patterns must be in the form of (elem|*)[@(attr|*)] to tell the IndexManager which element types to send to it, so for example:

          contact@name  Indexes all contacts by name attribute
          memo          Indexes the text of all memo elements
          contact@*     Indexes all contact attributes
          *@name        Indexes the name attribute for all elements
          *             Indexes the text of all elements
          *@*           Indexes all attributes of all elements

  These patterns are used by the IndexManager when handling SAX events. All events that match the specified pattern will result in an add or remove call to the Indexer.

  Specified by:
    `getPattern` in interface `Indexer`
  Returns:
    The Pattern used

### remove

    public void remove(Transaction tx,
                       java.lang.String value,
                       Key key,
                       int pos,
                       int elemID,
                       int attrID)
                throws DBException

  Description copied from interface: `Indexer`
  remove removes all references to the specified Key from the Indexer.

  Specified by:
    `remove` in interface `Indexer`
  Parameters:
    `tx` - The controlling Transaction
    `value` - The value to remove
    `key` - The Object ID
    `pos` - The offset into the stream the Element occurs at
    `elemID` - The Element ID of the value
    `attrID` - The Attribute ID of the value (if any, else -1)
  Throws:
    `DBException`

### add

    public void add(Transaction tx,
                    java.lang.String value,
                    Key key,
                    int pos,
                    int elemID,
                    int attrID)
             throws DBException

  Description copied from interface: `Indexer`
  add adds a Document to the Indexer.

  Specified by:
    `add` in interface `Indexer`
  Parameters:
    `tx` - The controlling Transaction
    `value` - The value to remove
    `key` - The Object ID
    `pos` - The offset into the stream the Element occurs at
    `elemID` - The Element ID of the value
    `attrID` - The Attribute ID of the value (if any, else -1)
  Throws:
    `DBException`

### queryMatches

    public IndexMatch[] queryMatches(Transaction tx,
                                     IndexQuery query)
                              throws DBException

  Description copied from interface: `Indexer`
  queryMatches retrieves a set of MatchEntry instances that match the supplied query. The matches are then used by the QueryEngine in co-sequential processing. If this indexer doesn't support the passed value, it should return 'null'. If no matches are found, it should return an empty set. queryMatches will typically be used in XPath processing.

  Specified by:
    `queryMatches` in interface `Indexer`
  Parameters:
    `tx` - The controlling Transaction
    `query` - The IndexQuery to use
  Returns:
    The resulting matches
  Throws:
    `DBException`

dbXML API

Copyright (c) 2004 The dbXML Group