]
Emmanuel Bernard reassigned HSEARCH-601:
----------------------------------------
Assignee: Sanne Grinovero
Assigning to SAnne so he can chose a proper version resolution.
Allow MassIndexer to recover gracefully when individual objects
won't index
---------------------------------------------------------------------------
Key: HSEARCH-601
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-601
Project: Hibernate Search
Issue Type: Improvement
Components: massindexer
Affects Versions: 3.2.0.Final
Environment: Hibernate 3.5.3, SQL Server 2005
Reporter: Ben Dotte
Assignee: Sanne Grinovero
Fix For: 3.3.0.Beta2
Some of our sites take hours to index, so it is critical that initial indexing complete
even if some of the individual entities fail to index properly. Right now, it appears that
the MassIndexer dies if any individual entity throws an exception during indexing, and
does not complete indexing for that type.
I have a workaround for now by overriding EntityConsumerLuceneworkProducer with my own
index() method that catches and logs exceptions from docBuilder.createAddWork():
private void index( Object entity, Session session ) throws InterruptedException {
Serializable id = session.getIdentifier( entity );
Class clazz = Hibernate.getClass( entity );
DocumentBuilderIndexedEntity docBuilder = documentBuilders.get( clazz );
TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
String idInString = idBridge.objectToString( id );
//depending on the complexity of the object graph going to be indexed it's
possible
//that we hit the database several times during work construction.
try
{
AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, true
);
backend.enqueueAsyncWork( addWork );
}
catch (Exception e)
{
log.error("Error indexing " + clazz + " id " + id, e);
}
}
This has the added benefit that the object type and id that errored is logged, where that
can be tough to track down otherwise.
That may not be the best solution in general since it could hide exceptions from
Hibernate Search itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: