Search in sources :

Example 1 with MassIndexer

use of org.hibernate.search.MassIndexer in project ice by JBEI.

the class RebuildLuceneIndexTask method execute.

@Override
public void execute() {
    Logger.info("Rebuilding lucene index in background");
    try {
        Session session = HibernateUtil.newSession();
        FullTextSession fullTextSession = Search.getFullTextSession(session);
        MassIndexer indexer = fullTextSession.createIndexer();
        indexer.idFetchSize(20);
        indexer.progressMonitor(IndexerProgressMonitor.getInstance());
        indexer.startAndWait();
    } catch (HibernateException he) {
        Logger.error(he);
    } catch (InterruptedException e) {
        Thread.interrupted();
        Logger.warn("Indexing incomplete");
    }
}
Also used : FullTextSession(org.hibernate.search.FullTextSession) MassIndexer(org.hibernate.search.MassIndexer) HibernateException(org.hibernate.HibernateException) FullTextSession(org.hibernate.search.FullTextSession) Session(org.hibernate.Session)

Aggregations

HibernateException (org.hibernate.HibernateException)1 Session (org.hibernate.Session)1 FullTextSession (org.hibernate.search.FullTextSession)1 MassIndexer (org.hibernate.search.MassIndexer)1