[hibernate-dev] HSEARCH-1225

Sanne Grinovero sanne at hibernate.org
Sun Oct 21 16:25:51 EDT 2012


The issue  HSEARCH-1225 is about clarifying what is supposed to happen
when an entity type is having an EntityIndexingInterceptor registered
and the following method is called:

org.hibernate.search.FullTextSession.index(T)

Today, this method is ignoring the conditional indexing interceptor
altogether; this might be considered correct, but we should clarify it
as it brought some confusion.

As a reference this is the EntityIndexingInterceptor interface source code:

public interface EntityIndexingInterceptor<T> {
	IndexingOverride onAdd(T entity);
	IndexingOverride onUpdate(T entity);
	IndexingOverride onDelete(T entity);
	IndexingOverride onCollectionUpdate(T entity);

	//FIXME should we add onPurge and onIndex?
}

My first idea about this was to clarify in documentation & javadoc
that the index() is going to ignore the interceptor. I thought that
would be a good idea so that users can have a method to override any
framework decision and force the write to be applied.

On the other hand, adding the methods mentioned in the FIXME would be
straight forward too, and while I'd expect most people to implement
onIndex() as return APPLY_DEFAULT, this might be a more elegant way
to:
 - let the user choose about this
 - make it very explicit what is going to happen

This looks like the best way to go, unfortunately it breaks backwards
compatibility but it was clearly marked as experimental in all media.

Thoughts?

#purgeAll
Of course the #purge method needs to be addressed in some consistent
way, but we can't implement it easily (and very slowly) on purgeAll.
One could redesign the MassIndexer pattern to be reused by a
mass-purger but I don't think it's worth it.

Cheers,
Sanne


More information about the hibernate-dev mailing list