@SuppressWarnings("unchecked")
private void index(Object entity, Session session, InstanceInitializer sessionInitializer, ConversionContext conversionContext)
throws InterruptedException {
Serializable id = session.getIdentifier( entity );
Class<?> clazz = HibernateHelper.getClass( entity );
EntityIndexBinding entityIndexBinding = entityIndexBinders.get( clazz );
if ( entityIndexBinding == null ) {
// it might be possible to receive not-indexes subclasses of the currently indexed type;
// being not-indexed, we skip them.
// FIXME for improved performance: avoid loading them in an early phase.
return;
}
EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor();
if ( interceptor != null ) {
IndexingOverride onAdd = interceptor.onAdd( entity );
switch ( onAdd ) {
case REMOVE:
case SKIP:
return;
}
//default: continue indexing this instance
}
DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder();
TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
conversionContext.pushProperty( docBuilder.getIdKeywordName() );
String idInString = null;
try {
idInString = conversionContext