public class LuceneIndexManager extends Object implements IndexManager
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
private URI |
baseFolderURI |
static String |
DIR_LUCENE
The lucene search index directory
|
protected static Map<Book,Index> |
INDEXES
The created indexes
|
private static org.slf4j.Logger |
log
The log stream
|
private IndexPolicy |
policy |
| Constructor and Description |
|---|
LuceneIndexManager()
Create a LuceneIndexManager with a default IndexPolicy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeAllIndexes()
Close all indexes associated with this Index Manager
|
void |
deleteIndex(Book book)
Tidy up after yourself and remove all the files that make up any indexes
you created.
|
Index |
getIndex(Book book)
Create a new Searcher.
|
IndexPolicy |
getIndexPolicy()
Obtain the current IndexPolicy.
|
protected URI |
getStorageArea(Book book)
Determine where an index should be stored
|
void |
installDownloadedIndex(Book book,
URI tempDest)
We have downloaded a search index to a zip file.
|
boolean |
isIndexed(Book book)
Detects if index data has been stored and is valid for this Bible.
|
boolean |
needsReindexing(Book book)
Clients can use this to determine if book's index is stale and needs to re-indexed or downloaded.
|
void |
scheduleIndexCreation(Book book)
Read from the given source version to generate ourselves.
|
void |
setIndexPolicy(IndexPolicy policy)
Set the desired IndexPolicy.
|
private IndexPolicy policy
private URI baseFolderURI
public static final String DIR_LUCENE
private static final org.slf4j.Logger log
public LuceneIndexManager()
public boolean isIndexed(Book book)
IndexManagerisIndexed in interface IndexManagerbook - the bookpublic Index getIndex(Book book) throws BookException
IndexManagergetIndex in interface IndexManagerbook - the bookBookExceptionpublic boolean needsReindexing(Book book)
needsReindexing in interface IndexManagerbook - the BookIndexManager.needsReindexing(org.crosswire.jsword.book.Book)public void closeAllIndexes()
IndexManagercloseAllIndexes in interface IndexManagerpublic void scheduleIndexCreation(Book book)
IndexManagerscheduleIndexCreation in interface IndexManagerbook - The book that should be indexedpublic void installDownloadedIndex(Book book, URI tempDest) throws BookException
IndexManagerinstallDownloadedIndex in interface IndexManagerbook - The book that we downloaded an index fortempDest - The URI of a zip file to installBookExceptionpublic void deleteIndex(Book book) throws BookException
IndexManagerdeleteIndex in interface IndexManagerbook - the book who's index should be deleted.BookExceptionpublic IndexPolicy getIndexPolicy()
IndexManagergetIndexPolicy in interface IndexManagerpublic void setIndexPolicy(IndexPolicy policy)
IndexManagersetIndexPolicy in interface IndexManagerpolicy - the IndexPolicy to use when creating indexes.protected URI getStorageArea(Book book) throws IOException
book - The book to be indexedIOException - If there is a problem in finding where to store stuff