Xindice API
version 1.2m1

org.apache.xindice.core.indexer
Class ValueIndexer

java.lang.Object
  extended byorg.apache.xindice.core.filer.Paged
      extended byorg.apache.xindice.core.filer.BTree
          extended byorg.apache.xindice.core.indexer.ValueIndexer
All Implemented Interfaces:
Configurable, DBObject, Indexer, Named

public final class ValueIndexer
extends BTree
implements Indexer

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

Version:
$Revision: 571949 $, $Date: 2007-09-02 06:52:38 -0400 (Sun, 02 Sep 2007) $

Nested Class Summary
 
Nested classes inherited from class org.apache.xindice.core.filer.BTree
BTree.BTreeFileHeader, BTree.BTreePageHeader, BTree.BTreeRootInfo
 
Nested classes inherited from class org.apache.xindice.core.filer.Paged
Paged.FileHeader, Paged.Page, Paged.PageHeader, Paged.PageKey
 
Field Summary
 
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
ValueIndexer()
           
 
Method Summary
protected  Paged.FileHeader createFileHeader()
          Override createFileHeader - set page size to 1024
 IndexerEventHandler getIndexerEventHandler()
          getIndexerEventHandler returns an instance of IndexerEventHandler that handles Indexer-specific events.
 String getIndexStyle()
          getIndexStyle returns the Index style.
 String getName()
          getName retrieves the contextually important name of the object
 IndexPattern[] getPatterns()
          getPatterns returns the patterns recognized by this Indexer.
 Value getTypedValue(String value)
          Creates new Value object that depends on string parameter and a type of indexer.
 IndexMatch[] queryMatches(IndexQuery query)
          queryMatches retrieves a set of IndexMatch instances that match the supplied query.
 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.
 
Methods inherited from class org.apache.xindice.core.filer.BTree
addKey, addValue, addValue, close, create, createBTreeRoot, createBTreeRoot, 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

ValueIndexer

public ValueIndexer()
Method Detail

createFileHeader

protected Paged.FileHeader createFileHeader()
Override createFileHeader - set page size to 1024

Overrides:
createFileHeader in class BTree

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

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

getName

public String getName()
Description copied from interface: Named
getName retrieves the contextually important name of the object

Specified by:
getName in interface Named
Returns:
The object's name

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
Returns:
The index style

getPatterns

public IndexPattern[] getPatterns()
Description copied from interface: Indexer
getPatterns returns the patterns 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 any of specified patterns will result in an call to the Indexer's event handler.

Specified by:
getPatterns in interface Indexer
Returns:
The Patterns used

getTypedValue

public Value getTypedValue(String value)
Creates new Value object that depends on string parameter and a type of indexer. The idea here is that any value of any type should be transformed to a byte array in such a way that two Values of the same type are comparable. Value objects are compared by comparing their data arrays byte-by-byte, starting from byte with index 0. Also, data arrays will behave as array of unsigned bytes with values ranging from 0 to 255.

Parameters:
value - string value to convert
Returns:
new Value object that represents specific value of this indexer type

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
Parameters:
query - The IndexQuery to use
Returns:
The resulting matches
Throws:
DBException

getIndexerEventHandler

public IndexerEventHandler getIndexerEventHandler()
Description copied from interface: Indexer
getIndexerEventHandler returns an instance of IndexerEventHandler that handles Indexer-specific events. This method is called once per document, and all events for one document will be processed by the same handler.

Specified by:
getIndexerEventHandler in interface Indexer
Returns:
IndexerEventHandler that will handle document processing
See Also:
IndexerEventHandler

Xindice API
version 1.2m1

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