}
public static SearchFactoryImplementor getSearchFactoryBySFI(SessionImplementor session) {
PostInsertEventListener[] listeners = session.getListeners().getPostInsertEventListeners();
FullTextIndexEventListener listener = null;
//FIXME this sucks since we mandate the event listener use
for ( PostInsertEventListener candidate : listeners ) {
if ( candidate instanceof FullTextIndexEventListener ) {
listener = (FullTextIndexEventListener) candidate;
break;
}
}
if ( listener == null ) throw new HibernateException(
"Hibernate Search Event listeners not configured, please check the reference documentation and the " +
"application's hibernate.cfg.xml" );
return listener.getSearchFactoryImplementor();
}