org.crosswire.jsword.index
Interface IndexManager

All Known Implementing Classes:
LuceneIndexManager

public interface IndexManager

Manages the life-cycle of an Index.

Author:
Joe Walker
See Also:
The GNU Lesser General Public License for details.

Method Summary
 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.
 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)
          Detect or checking whether this book needs reindexing.
 void scheduleIndexCreation(Book book)
          Read from the given source version to generate ourselves.
 void setIndexPolicy(IndexPolicy policy)
          Set the desired IndexPolicy.
 

Method Detail

isIndexed

boolean isIndexed(Book book)
Detects if index data has been stored and is valid for this Bible.

Parameters:
book - the book
Returns:
true if the book has a usable index

getIndex

Index getIndex(Book book)
               throws BookException
Create a new Searcher.

Parameters:
book - the book
Returns:
an index that can be searched.
Throws:
BookException

needsReindexing

boolean needsReindexing(Book book)
Detect or checking whether this book needs reindexing. It is safe methods, you can always call it whether the book is already indexed or not. This check for
 - isIndexed(Book book)
 - Is index valid, eg index version changed incompatibly (due to internal structure change or search engine update)
 -
 

Parameters:
book - the Book
Returns:
true if no index present or current index is of incompatible/older version

scheduleIndexCreation

void scheduleIndexCreation(Book book)
Read from the given source version to generate ourselves. On completion of this method the index should be usable.

Parameters:
book - The book that should be indexed

installDownloadedIndex

void installDownloadedIndex(Book book,
                            URI tempDest)
                            throws BookException
We have downloaded a search index to a zip file. It should be installed from here.

Parameters:
book - The book that we downloaded an index for
tempDest - The URI of a zip file to install
Throws:
BookException

deleteIndex

void deleteIndex(Book book)
                 throws BookException
Tidy up after yourself and remove all the files that make up any indexes you created.

Parameters:
book - the book who's index should be deleted.
Throws:
BookException

closeAllIndexes

void closeAllIndexes()
Close all indexes associated with this Index Manager


getIndexPolicy

IndexPolicy getIndexPolicy()
Obtain the current IndexPolicy. Defaults to IndexPolicyAdapter.

Returns:
the current IndexPolicy

setIndexPolicy

void setIndexPolicy(IndexPolicy policy)
Set the desired IndexPolicy. Setting to null will cause the IndexPolicyAdapter to be used.

Parameters:
policy - the IndexPolicy to use when creating indexes.

Copyright ยจ 2003-2015