-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Search: Modifying object within ClassBridge?
PostPosted: Sun Oct 14, 2007 11:14 pm 
Newbie

Joined: Thu Aug 17, 2006 1:40 am
Posts: 2
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 3:47 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Are you still having this problem? I had a quick look at the code and the bridge should only be run when an object is added or updated or when you explicitly index via FullTextSession.index(). Delete operations and index purging should not give you a callback in the FieldBridge.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 10:35 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
A test case would be helpful to figure that out

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.