Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.index.lucene
Class LuceneIndexManager

    java.lang.Object
      org.crosswire.jsword.index.lucene.LuceneIndexManager

All Implemented Interfaces:
  IndexManager

    public class LuceneIndexManager

extends Object
implements IndexManager

An implementation of IndexManager for Lucene indexes.

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

Field Summary
`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 Summary
`LuceneIndexManager()` Create a LuceneIndexManager with a default IndexPolicy.

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.
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### policy

    private IndexPolicy policy

### baseFolderURI

    private URI baseFolderURI

### INDEXES

    protected static final Map<Book,Index> INDEXES

  The created indexes

### DIR_LUCENE

    public static final String DIR_LUCENE

  The lucene search index directory

  See Also:
    Constant Field Values

### log

    private static final org.slf4j.Logger log

  The log stream

Constructor Detail

### LuceneIndexManager

    public LuceneIndexManager()

  Create a LuceneIndexManager with a default IndexPolicy.

Method Detail

### isIndexed

    public boolean isIndexed(Book book)

  Description copied from interface: `IndexManager`
  Detects if index data has been stored and is valid for this Bible.

  Specified by:
    `isIndexed` in interface `IndexManager`
  Parameters:
    `book` - the book
  Returns:
    true if the book has a usable index

### getIndex

    public Index getIndex(Book book)
                   throws BookException

  Description copied from interface: `IndexManager`
  Create a new Searcher.

  Specified by:
    `getIndex` in interface `IndexManager`
  Parameters:
    `book` - the book
  Returns:
    an index that can be searched.
  Throws:
    `BookException`

### needsReindexing

    public boolean needsReindexing(Book book)

  Clients can use this to determine if book's index is stale and needs to re-indexed or downloaded. Assumes index exists: Client must use isIndexed() prior to using this method

  Specified by:
    `needsReindexing` in interface `IndexManager`
  Parameters:
    `book` - the Book
  Returns:
    true, if Latest.Index.Version.xxx > Installed.Index.Version.xxx
  See Also:
    `IndexManager.needsReindexing(org.crosswire.jsword.book.Book)`

### closeAllIndexes

    public void closeAllIndexes()

  Description copied from interface: `IndexManager`
  Close all indexes associated with this Index Manager

  Specified by:
    `closeAllIndexes` in interface `IndexManager`

### scheduleIndexCreation

    public void scheduleIndexCreation(Book book)

  Description copied from interface: `IndexManager`
  Read from the given source version to generate ourselves. On completion of this method the index should be usable.

  Specified by:
    `scheduleIndexCreation` in interface `IndexManager`
  Parameters:
    `book` - The book that should be indexed

### installDownloadedIndex

    public void installDownloadedIndex(Book book,
                                       URI tempDest)
                                throws BookException

  Description copied from interface: `IndexManager`
  We have downloaded a search index to a zip file. It should be installed from here.

  Specified by:
    `installDownloadedIndex` in interface `IndexManager`
  Parameters:
    `book` - The book that we downloaded an index for
    `tempDest` - The URI of a zip file to install
  Throws:
    `BookException`

### deleteIndex

    public void deleteIndex(Book book)
                     throws BookException

  Description copied from interface: `IndexManager`
  Tidy up after yourself and remove all the files that make up any indexes you created.

  Specified by:
    `deleteIndex` in interface `IndexManager`
  Parameters:
    `book` - the book who's index should be deleted.
  Throws:
    `BookException`

### getIndexPolicy

    public IndexPolicy getIndexPolicy()

  Description copied from interface: `IndexManager`
  Obtain the current IndexPolicy. Defaults to IndexPolicyAdapter.

  Specified by:
    `getIndexPolicy` in interface `IndexManager`
  Returns:
    the current IndexPolicy

### setIndexPolicy

    public void setIndexPolicy(IndexPolicy policy)

  Description copied from interface: `IndexManager`
  Set the desired IndexPolicy. Setting to null will cause the IndexPolicyAdapter to be used.

  Specified by:
    `setIndexPolicy` in interface `IndexManager`
  Parameters:
    `policy` - the IndexPolicy to use when creating indexes.

### getStorageArea

    protected URI getStorageArea(Book book)
                          throws IOException

  Determine where an index should be stored

  Parameters:
    `book` - The book to be indexed
  Returns:
    A URI to store stuff in
  Throws:
    `IOException` - If there is a problem in finding where to store stuff

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD