|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.creole.annic.lucene.LuceneIndexer
public class LuceneIndexer
This class provides a Lucene based implementation for the Indexer interface. It asks users to provide various required parameters and creates the Lucene Index.
| Field Summary | |
|---|---|
protected Corpus |
corpus
An corpus for indexing |
protected boolean |
DEBUG
|
protected Map |
parameters
Various parameters such as location of the Index etc. |
| Constructor Summary | |
|---|---|
LuceneIndexer(URL indexLocationUrl)
Constructor |
|
| Method Summary | |
|---|---|
void |
add(String corpusPersistenceID,
List<Document> added)
Add new documents to Index |
protected void |
checkIndexParameters(Map parameters)
Checks the Index Parameters to see if they are all compatible |
void |
createIndex(Map indexParameters)
Creates index directory and indexing all documents in the corpus. |
void |
deleteIndex()
Deletes the index. |
private String |
getCompatibleName(String name)
|
Corpus |
getCorpus()
Returns the corpus. |
protected Map |
getIndexParameters()
Returns the indexing parameters |
private List<Document> |
getLuceneDocuments(String corpusPersistenceID,
Document gateDoc,
String location)
We create a separate Lucene document for each index unit available in the gate document. |
Set<String> |
getNamesOfSerializedFiles(String documentID)
This method returns a set of annotation set names that are indexed. |
Map |
getParameters()
Returns the set parameters |
void |
optimizeIndex()
Optimize existing index. |
private void |
readParametersFromDisk(URL indexLocationUrl)
This method, searchers for the LuceneIndexDefinition.xml file at the provided location. |
void |
remove(List removedIDs)
remove documents from the Index |
void |
setCorpus(Corpus corpus)
Sets the corpus. |
private void |
writeParametersToDisk()
All Index parameters are stored on a disc at the index_location_url/LuceneIndexDefinition.xml file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean DEBUG
protected Corpus corpus
protected Map parameters
| Constructor Detail |
|---|
public LuceneIndexer(URL indexLocationUrl)
throws IOException
indexLocationUrl -
IOException| Method Detail |
|---|
protected void checkIndexParameters(Map parameters)
throws IndexException
IndexExceptionprotected Map getIndexParameters()
public void createIndex(Map indexParameters)
throws IndexException
createIndex in interface IndexerindexParameters - This is a map containing various values
required to create an index In case of LuceneIndexManager
following are the values required
INDEX_LOCATION_URL - this is a URL where the Index be created
BASE_TOKEN_ANNOTATION_TYPE
INDEX_UNIT_ANNOTATION_TYPE
FEATURES_TO_EXCLUDE
FEATURES_TO_INCLUDE
IndexException
public void optimizeIndex()
throws IndexException
optimizeIndex in interface IndexerIndexException
public void deleteIndex()
throws IndexException
deleteIndex in interface IndexerIndexException
public void add(String corpusPersistenceID,
List<Document> added)
throws IndexException
add in interface IndexercorpusPersistenceID - addedDocuments -
IndexExceptionprivate String getCompatibleName(String name)
public void remove(List removedIDs)
throws IndexException
remove in interface IndexerremovedDocumentPersistenceIds - - when documents are not
peristed, Persistence IDs will not be available In that
case provide the document Names instead of their IDs
Exception
IndexException
private List<Document> getLuceneDocuments(String corpusPersistenceID,
Document gateDoc,
String location)
throws IndexException
corpusPersistenceID - gateDoc - location -
IndexExceptionpublic Corpus getCorpus()
getCorpus in interface Indexer
public void setCorpus(Corpus corpus)
throws IndexException
setCorpus in interface IndexerIndexException
private void readParametersFromDisk(URL indexLocationUrl)
throws IOException
indexLocationUrl -
IOException
private void writeParametersToDisk()
throws IOException
IOExceptionpublic Map getParameters()
getParameters in interface Indexer
public Set<String> getNamesOfSerializedFiles(String documentID)
throws IndexException
IndexException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||