| Constructor and Description |
|---|
PensieveWriter(org.apache.lucene.store.Directory indexDirectory,
boolean createNewTmIndex)
Creates a PensieveWriter
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Commits and closes (for now) the transaction.
|
void |
commit()
Forces a commit against the index.
|
void |
delete(String id)
Deletes a TranslationUnit based on the id.
|
org.apache.lucene.index.IndexWriter |
getIndexWriter()
Gets a handle on the IndexWriter so that commits and rollbacks can happen outside.
|
void |
indexTranslationUnit(TranslationUnit tu)
Adds a TranslationUnit to the index
|
void |
indexTranslationUnit(TranslationUnit tu,
boolean overwrite)
Indexes a given translation unit, possibly overwriting an existing one with the same source.
|
void |
update(TranslationUnit tu)
Updates a TranslationUnit.
|
public PensieveWriter(org.apache.lucene.store.Directory indexDirectory,
boolean createNewTmIndex)
throws IOException
indexDirectory - - the Lucene Directory implementation of choice.createNewTmIndex - Set to false to append to the existing TM index file. Set to true to overwrite.IOException - if the indexDirectory can not loadpublic void close()
close in interface ITmWriterOkapiIOException - if the commit cannot happen.public void commit()
public org.apache.lucene.index.IndexWriter getIndexWriter()
public void indexTranslationUnit(TranslationUnit tu)
indexTranslationUnit in interface ITmWritertu - The TranslationUnit to indexIOException - if the TU can not be indexed.IllegalArgumentException - if tu is nullpublic void indexTranslationUnit(TranslationUnit tu, boolean overwrite)
ITmWriterindexTranslationUnit in interface ITmWritertu - the translation unit to index.overwrite - true to overwrite any existing unit that has the same source content (codes excluded)public void delete(String id)
delete in interface ITmWriterid - The Unique ID of the TU to deleteOkapiIOException - if the delete can not happenIllegalArgumentException - if the id is invalidpublic void update(TranslationUnit tu)
update in interface ITmWritertu - The TranslationUnit to updateIOException - if the update can not happenIllegalArgumentException - if the tu or MetadataType.ID is nullCopyright © 2021. All rights reserved.