org.openanzo.indexer
Interface IIndexer

All Known Implementing Classes:
LiteralIndexer, LuceneIndexerBase, ModelIndexer

public interface IIndexer

Generic interface for a text indexer. Currently there is only one implementation (Lucene).

Author:
Wing Yung (wingyung@us.ibm.com)

Method Summary
 void clear()
          Clears the contents of the index.
 void close()
          Cleans up the indexer, freeing resources.
 boolean index(int id, java.lang.Object object)
          Adds the object to the index.
 void initialize(java.util.Properties properties)
          Initializes the indexer with a properties object.
 void postIndex(int id)
          Called after indexing of a set of statements is complete.
 void postRemove(int id)
          Called after removing a set of statements is complete.
 int preIndex()
          Prepares the indexer for calls to index().
 int preRemove()
          Prepares the indexer for calls to remove().
 int rebuild(java.lang.Object seedObject)
          Rebuilds the index given the seed object.
 void remove(int id, java.lang.Object object)
          Removes the object from the index.
 

Method Detail

initialize

void initialize(java.util.Properties properties)
                throws IndexerException
Initializes the indexer with a properties object.

Parameters:
properties - configuration for the indexer, usually comes from a .properties file
Throws:
IndexerException - if there were errors initializing the indexer

preIndex

int preIndex()
             throws IndexerException
Prepares the indexer for calls to index().

Returns:
an identifier that is meant to be passed into index().
Throws:
IndexerException

postIndex

void postIndex(int id)
               throws IndexerException
Called after indexing of a set of statements is complete.

Parameters:
id - id of the indexer, generated by preIndex()
Throws:
IndexerException

index

boolean index(int id,
              java.lang.Object object)
              throws IndexerException
Adds the object to the index.

Parameters:
id - id of the indexer, generated by preIndex()
object - object to add to the index.
Returns:
true if indexing object was successfull
Throws:
IndexerException

preRemove

int preRemove()
              throws IndexerException
Prepares the indexer for calls to remove().

Returns:
an identifier that is meant to be passed into remove().
Throws:
IndexerException

postRemove

void postRemove(int id)
                throws IndexerException
Called after removing a set of statements is complete.

Parameters:
id - id of the indexer, generated by preRemove()
Throws:
IndexerException

remove

void remove(int id,
            java.lang.Object object)
            throws IndexerException
Removes the object from the index.

Parameters:
id - id of the indexer, generated by preIndex()
object - object to remove from the index.
Throws:
IndexerException

clear

void clear()
           throws IndexerException
Clears the contents of the index.

Throws:
IndexerException

close

void close()
           throws IndexerException
Cleans up the indexer, freeing resources. The indexer should not be used after it is closed.

Throws:
IndexerException

rebuild

int rebuild(java.lang.Object seedObject)
            throws IndexerException
Rebuilds the index given the seed object.

Parameters:
seedObject - object used to rebuild the entire index
Returns:
id of the indexer
Throws:
IndexerException


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.