[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-361) Only index an entity if an indexed property has changed

Sanne Grinovero (JIRA) noreply at atlassian.com
Thu Oct 29 11:37:13 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34347#action_34347 ] 

Sanne Grinovero commented on HSEARCH-361:
-----------------------------------------

I'd like to delegate the isDirty() decision to the ClassBridge itself adding a new method to this IncrementalBridge. It's his own business how to cope with the mapping, so it should know what to do.

Breaking current API adding something like a isDocumentDirty() would be a good way to let the users of the API know how this behaves, so no nasty surprises as you implemented the method yourself when you created the implementation. Sure, we could provide some helpers to delegate to, but it would be a developer's decision.

Could pass appropriate parameters to this function, like the current Document, current state and oldState. I'd recommend to *not* pass the Document directly but giving it an object with having a getter to reach the Document, so to avoid I/O if the implementation is not interested in loading the Document.

A simple always valid implementation would be "return true", even if it's suboptimal. Same story of "return 1" being a valid implementation for hashCode().

Speaking about hashing, I don't see how this can help. Different hashes means the objects are different, sure, but we need the other way around and it's not true that different objects have a different hash.
So when checking for indexchanges, if hashes are different, you reindex. If hashes are equal, you still don't know for sure and so you have to reindex the same: storing hashes is pointless.

I'd vote to add the IncrementalBridge(newInterfaceWithDelegation), and focus on the only known working implementation so far which is IMHO dirty checking on indexed fields, and give freedom to implement something different.


> Only index an entity if an indexed property has changed
> -------------------------------------------------------
>
>                 Key: HSEARCH-361
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-361
>             Project: Hibernate Search
>          Issue Type: New Feature
>            Reporter: Emmanuel Bernard
>             Fix For: 3.2.0
>
>
> PostUpdateEvent has state and oldState
> and EntityPersister has getPropertyNames() and findDirty()

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list