use of org.crosswire.jsword.index.IndexManager in project step by STEPBible.
the class JSwordSearchServiceImpl method getIndexSearcher.
/**
* Retrieves the index from JSword
* @param bookName the book name
* @return the index searcher responsible for carrying out operations on JSword data.
*/
public IndexSearcher getIndexSearcher(String bookName) {
final IndexManager indexManager = IndexManagerFactory.getIndexManager();
Index index;
try {
index = indexManager.getIndex(this.av11nService.getBookFromVersion(bookName));
} catch (BookException e) {
throw new StepInternalException(e.getMessage(), e);
}
if (!(index instanceof LuceneIndex)) {
LOGGER.warn("Unsupported Lucene Index type [{}]", index.getClass());
throw new StepInternalException("Unable to obtain index");
}
@SuppressWarnings("resource") final LuceneIndex li = (LuceneIndex) index;
return (IndexSearcher) li.getSearcher();
}
use of org.crosswire.jsword.index.IndexManager in project step by STEPBible.
the class JSwordModuleServiceImpl method index.
@Override
public void index(final String initials) {
final IndexManager indexManager = IndexManagerFactory.getIndexManager();
final Book book = this.versificationService.getBookFromVersion(initials);
if (!indexManager.isIndexed(book)) {
indexManager.scheduleIndexCreation(book);
}
}
Aggregations