I have a custom ClassBridge implementation which parses a stream contained within the object (could be xml, txt, html etc), extracts the text from it and adds it to the lucene document passed in to the ClassBridge set method which is overridden.
This parsing operation can possibly fail, so I have a non-indexed field in the object which displays the 'indexing status' of the stream - whether an error occurred, parsing was successful, or the parser didn't know how to handle the document type.
What I would like to do is modify this field from within the ClassBridge depending on the success of the parsing. I've tried it and had success when persisting/updating, however when deleting objects they become removed from the lucene directory, and then straight afterwards re-added again.
It seems that the ClassBridge set method gets run when the object is deleted, which makes the object dirty because of the field set, and then gets put back in the lucene directory.
Is modifying the object in the set method a complete no-no, or is there a possible solution to this? Should the ClassBridge set method even be run when deleting an object?
Cheers,
--Alan
|