gate.creole.ir.lucene
Class LuceneIndexManager

java.lang.Object
  |
  +--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
private  Corpus corpus
          An corpus for indexing
static String DOCUMENT_ID
          used in Lucene Documents as a key for gate document ID value.
private  IndexDefinition indexDefinition
          IndexDefinition - location, type, fields, etc.
 
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.
private  org.apache.lucene.document.Document getLuceneDoc(Document gateDoc)
           
 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

indexDefinition

private IndexDefinition indexDefinition
IndexDefinition - location, type, fields, etc.


corpus

private Corpus corpus
An corpus for indexing

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
IndexException

optimizeIndex

public void optimizeIndex()
                   throws IndexException
Optimize existing index.

Specified by:
optimizeIndex in interface IndexManager
IndexException

deleteIndex

public void deleteIndex()
                 throws IndexException
Delete index.

Specified by:
deleteIndex in interface IndexManager
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
IndexException

getLuceneDoc

private org.apache.lucene.document.Document getLuceneDoc(Document gateDoc)

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.