final EventListenerRegistry service = sfi
.getServiceRegistry()
.getService( EventListenerRegistry.class );
final Iterable<PostInsertEventListener> listeners = service.getEventListenerGroup( EventType.POST_INSERT )
.listeners();
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();
}