gate.creole.ir.lucene
Class LuceneIndexManager

java.lang.Object
  extended by gate.creole.ir.lucene.LuceneIndexManager
All Implemented Interfaces:
IndexManager

public class LuceneIndexManager
extends Object
implements IndexManager

This class represents Lucene implementation of IndexManeager interface.


Field Summary
static String CORPUS_INDEX_FEATURE
          constant that ensures that corpus is indexed with IR plugin
static String CORPUS_INDEX_FEATURE_VALUE
           
static String DOCUMENT_ID
          used in Lucene Documents as a key for gate document ID value.
 
Constructor Summary
LuceneIndexManager()
          Constructor of the class.
 
Method Summary
 void createIndex()
          Creates index directory and indexing all documents in the corpus.
 void deleteIndex()
          Delete index.
 Corpus getCorpus()
          Gets the corpus this index manages will index.
 IndexDefinition getIndexDefinition()
          Gets the index definition for this index manager.
 void optimizeIndex()
          Optimize existing index.
 void setCorpus(Corpus corpus)
          Sets the corpus this index manages will index.
 void setIndexDefinition(IndexDefinition indexDefinition)
          Sets the index definition for this index manager.
 void sync(List added, List removedIDs, List changed)
          Reindexing changed documents, removing removed documents and add to the index new corpus documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_ID

public static final String DOCUMENT_ID
used in Lucene Documents as a key for gate document ID value.

See Also:
Constant Field Values

CORPUS_INDEX_FEATURE

public static final String CORPUS_INDEX_FEATURE
constant that ensures that corpus is indexed with IR plugin

See Also:
Constant Field Values

CORPUS_INDEX_FEATURE_VALUE

public static final String CORPUS_INDEX_FEATURE_VALUE
See Also:
Constant Field Values
Constructor Detail

LuceneIndexManager

public LuceneIndexManager()
Constructor of the class.

Method Detail

createIndex

public void createIndex()
                 throws IndexException
Creates index directory and indexing all documents in the corpus.

Specified by:
createIndex in interface IndexManager
Throws:
IndexException

optimizeIndex

public void optimizeIndex()
                   throws IndexException
Optimize existing index.

Specified by:
optimizeIndex in interface IndexManager
Throws:
IndexException

deleteIndex

public void deleteIndex()
                 throws IndexException
Delete index.

Specified by:
deleteIndex in interface IndexManager
Throws:
IndexException

sync

public void sync(List added,
                 List removedIDs,
                 List changed)
          throws IndexException
Reindexing changed documents, removing removed documents and add to the index new corpus documents.

Specified by:
sync in interface IndexManager
Throws:
IndexException

getCorpus

public Corpus getCorpus()
Description copied from interface: IndexManager
Gets the corpus this index manages will index.

Specified by:
getCorpus in interface IndexManager
Returns:
a Corpus value;

setCorpus

public void setCorpus(Corpus corpus)
Description copied from interface: IndexManager
Sets the corpus this index manages will index.

Specified by:
setCorpus in interface IndexManager
Parameters:
corpus - a Corpus value;

getIndexDefinition

public IndexDefinition getIndexDefinition()
Description copied from interface: IndexManager
Gets the index definition for this index manager.

Specified by:
getIndexDefinition in interface IndexManager
Returns:
a IndexDefinition value.

setIndexDefinition

public void setIndexDefinition(IndexDefinition indexDefinition)
Description copied from interface: IndexManager
Sets the index definition for this index manager.

Specified by:
setIndexDefinition in interface IndexManager
Parameters:
indexDefinition - a IndexDefinition value.