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)
IndexManager
isIndexed
in interface IndexManager
book
- the bookpublic Index getIndex(Book book) throws BookException
IndexManager
getIndex
in interface IndexManager
book
- the bookBookException
public boolean needsReindexing(Book book)
needsReindexing
in interface IndexManager
book
- the BookIndexManager.needsReindexing(org.crosswire.jsword.book.Book)
public void closeAllIndexes()
IndexManager
closeAllIndexes
in interface IndexManager
public void scheduleIndexCreation(Book book)
IndexManager
scheduleIndexCreation
in interface IndexManager
book
- The book that should be indexedpublic void installDownloadedIndex(Book book, URI tempDest) throws BookException
IndexManager
installDownloadedIndex
in interface IndexManager
book
- The book that we downloaded an index fortempDest
- The URI of a zip file to installBookException
public void deleteIndex(Book book) throws BookException
IndexManager
deleteIndex
in interface IndexManager
book
- the book who's index should be deleted.BookException
public IndexPolicy getIndexPolicy()
IndexManager
getIndexPolicy
in interface IndexManager
public void setIndexPolicy(IndexPolicy policy)
IndexManager
setIndexPolicy
in interface IndexManager
policy
- 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