Xindice API
version 1.1

org.apache.xindice.core.indexer
Class NameIndexer

java.lang.Object
  |
  +--org.apache.xindice.core.filer.Paged
        |
        +--org.apache.xindice.core.filer.BTree
              |
              +--org.apache.xindice.core.indexer.NameIndexer
All Implemented Interfaces:
Configurable, DBObject, Indexer, Named

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.

Version:
$Revision: 519202 $, $Date: 2007-03-16 21:34:14 -0400 (Fri, 16 Mar 2007) $

Inner classes inherited from class org.apache.xindice.core.filer.BTree
BTree.BTreeFileHeader, BTree.BTreePageHeader, BTree.BTreeRootInfo
 
Inner classes inherited from class org.apache.xindice.core.filer.Paged
Paged.FileHeader, Paged.Page, Paged.PageHeader, Paged.PageKey
 
Fields inherited from class org.apache.xindice.core.filer.BTree
BRANCH, LEAF, STREAM
 
Fields inherited from class org.apache.xindice.core.filer.Paged
CONFIG_DESCRIPTORS_MAX, CONFIG_KEYSIZE_MAX, CONFIG_PAGECOUNT, CONFIG_PAGESIZE, DELETED, NO_PAGE, OVERFLOW, UNUSED
 
Fields inherited from interface org.apache.xindice.core.indexer.Indexer
STYLE_FULLTEXT, STYLE_NODENAME, STYLE_NODEVALUE
 
Constructor Summary
NameIndexer()
           
 
Method Summary
 void add(String value, Key key, int pos, int len, short elemID, short attrID)
          add adds a Document to the Indexer.
 String getIndexStyle()
          getIndexStyle returns the Index style.
 String getName()
          getName retrieves the contextually important name of the object
 String getPattern()
          getPattern returns the pattern recognized by this Indexer.
 IndexMatch[] queryMatches(IndexQuery query)
          queryMatches retrieves a set of IndexMatch instances that match the supplied query.
 void remove(String value, Key key, int pos, int len, short elemID, short 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(String location)
           
 
Methods inherited from class org.apache.xindice.core.filer.BTree
addKey, addValue, addValue, close, create, createBTreeRoot, createBTreeRoot, createFileHeader, createPageHeader, findBTreeRoot, findBTreeRoot, findValue, findValue, getRootNode, getRootNode, open, query, query, removeValue, removeValue, setRootNode, setRootNode
 
Methods inherited from class org.apache.xindice.core.filer.Paged
checkOpened, closeDescriptor, deleteArrayInt, deleteArrayLong, deleteArrayShort, deleteArrayValue, drop, exists, flush, getConfig, getDescriptor, getFile, getFileHeader, getFreePage, getPage, insertArrayInt, insertArrayLong, insertArrayShort, insertArrayValue, isOpened, putDescriptor, readValue, readValue, setFile, unlinkPages, unlinkPages, writeValue, writeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xindice.core.indexer.Indexer
flush
 
Methods inherited from interface org.apache.xindice.core.DBObject
close, create, drop, exists, isOpened, open
 
Methods inherited from interface org.apache.xindice.util.Configurable
getConfig
 

Constructor Detail

NameIndexer

public NameIndexer()
Method Detail

setConfig

public void setConfig(Configuration config)
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
Following copied from interface: org.apache.xindice.util.Configurable
Parameters:
config - The configuration Node

getName

public String getName()
Description copied from interface: Named
getName retrieves the contextually important name of the object
Specified by:
getName in interface Named
Following copied from interface: org.apache.xindice.util.Named
Returns:
The object's name

setLocation

public void setLocation(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
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Parameters:
collection - The owner Collection

getIndexStyle

public 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
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Returns:
The index style

getPattern

public 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
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Returns:
The Pattern used

remove

public void remove(String value,
                   Key key,
                   int pos,
                   int len,
                   short elemID,
                   short 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
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Parameters:
value - The value to remove
key - The Object ID
pos - The offset into the stream the Element occurs at
len - The length of the substream for the Element
elemID - The Element ID of the value
attrID - The Attribute ID of the value (if any, else -1)

add

public void add(String value,
                Key key,
                int pos,
                int len,
                short elemID,
                short attrID)
         throws DBException
Description copied from interface: Indexer
add adds a Document to the Indexer.
Specified by:
add in interface Indexer
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Parameters:
value - The value to remove
key - The Object ID
pos - The offset into the stream the Element occurs at
len - The length of the substream for the Element
elemID - The Element ID of the value
attrID - The Attribute ID of the value (if any, else -1)

queryMatches

public IndexMatch[] queryMatches(IndexQuery query)
                          throws DBException
Description copied from interface: Indexer
queryMatches retrieves a set of IndexMatch 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
Following copied from interface: org.apache.xindice.core.indexer.Indexer
Parameters:
query - The IndexQuery to use
Returns:
The resulting matches

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.