dbXML API

com.dbxml.db.core.indexer
Interface Indexer

All Superinterfaces:
Configurable
All Known Implementing Classes:
FullTextIndexer, NameIndexer, ValueIndexer

public interface Indexer
extends Configurable

Indexer is the abstract indexing interface for dbXML. An Indexer object is implemented in order to retrieve and manage indexes.

Any number of Indexer instances may be associated with a single Collection. The type of Indexer utilized by a query depends on the 'Style' of Indexer and the type of QueryResolver that is being used to performt he query. Currently, dbXML only internally supports one kind of Indexer: 'XPath'.


Field Summary
static java.lang.String STYLE_FULLTEXT
           
static java.lang.String STYLE_NODENAME
           
static java.lang.String STYLE_NODEVALUE
           
 
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.
 boolean close()
          close closes the Indexer
 boolean create()
          create creates a new Indexer and any associated resources for the new Indexer, such as disk files, etc.
 boolean drop()
          drop instructs the Indexer implementation to remove itself from existence.
 boolean exists()
          exists returns whether or not a physical representation of this Indexer actually exists.
 void flush(Transaction tx)
          flush forcefully flushes any unwritten buffers to disk.
 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.
 TransactionLog getTransactionLog()
          getTransactionLog returns the Transaction Log for this Indexer.
 boolean isOpened()
          isOpened returns whether or not the Indexer is opened for business.
 boolean open()
          open opens the 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.
 
Methods inherited from interface com.dbxml.util.Configurable
getConfig, setConfig
 

Field Detail

STYLE_NODENAME

public static final java.lang.String STYLE_NODENAME
See Also:
Constant Field Values

STYLE_NODEVALUE

public static final java.lang.String STYLE_NODEVALUE
See Also:
Constant Field Values

STYLE_FULLTEXT

public static final java.lang.String STYLE_FULLTEXT
See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
getName returns the name of this Indexer.

Returns:
the Indexer name

create

public boolean create()
               throws DBException
create creates a new Indexer and any associated resources for the new Indexer, such as disk files, etc.

Returns:
Whether or not the Indexer was created
Throws:
DBException

open

public boolean open()
             throws DBException
open opens the Indexer

Returns:
Whether or not the Indexer was opened
Throws:
DBException

isOpened

public boolean isOpened()
                 throws DBException
isOpened returns whether or not the Indexer is opened for business.

Returns:
The open status of the Indexer
Throws:
DBException

exists

public boolean exists()
               throws DBException
exists returns whether or not a physical representation of this Indexer actually exists.

Returns:
Whether or not the physical resource exists
Throws:
DBException

drop

public boolean drop()
             throws DBException
drop instructs the Indexer implementation to remove itself from existence. The Indexer's parent is responsible for removing any references to the Indexer in its own context.

Returns:
Whether or not the Indexer was dropped
Throws:
DBException

close

public boolean close()
              throws DBException
close closes the Indexer

Returns:
Whether or not the Indexer was closed
Throws:
DBException

setCollection

public void setCollection(Collection collection)
setCollection tells the Indexer who its parent is.

Parameters:
collection - The owner Collection

getIndexStyle

public java.lang.String getIndexStyle()
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.

Returns:
The index style

getPattern

public java.lang.String getPattern()
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.

Returns:
The Pattern used

remove

public void remove(Transaction tx,
                   java.lang.String value,
                   Key key,
                   int pos,
                   int elemID,
                   int attrID)
            throws DBException
remove removes all references to the specified Key from the 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
add adds a Document to the 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
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.

Parameters:
tx - The controlling Transaction
query - The IndexQuery to use
Returns:
The resulting matches
Throws:
DBException

flush

public void flush(Transaction tx)
           throws DBException
flush forcefully flushes any unwritten buffers to disk.

Parameters:
tx - The controlling Transaction
Throws:
DBException

getTransactionLog

public TransactionLog getTransactionLog()
                                 throws DBException
getTransactionLog returns the Transaction Log for this Indexer. This result may be null if the Indexer doesn't support transactional operations.

Returns:
The Indexer's TransactionLog
Throws:
DBException

dbXML API

Copyright (c) 2004 The dbXML Group