[hibernate-dev] Interceptor question

Sanne Grinovero sanne at hibernate.org
Fri May 11 12:07:45 EDT 2012

I was expecting you to argue about it, and therefore I concede that
some docs clarification at least is strongly required, but I disagree
on the expectations:

I see a fundamental difference in behaviour expectations between
 a) "sync up database and index"
 b) "index Entries A and B now"

In the first case it's up to Search to figure out what the correct set
of data is, and this would obviously be defined by the conventional
rules such as "all what's in the database", and implicitly by the

In the second case the user is explicitly demanding to index A and B;
just think about the meaning of using #index .. it should never be
needed if everything was perfectly in sync, so the intention of the
method is clearly an explicit override.

Makes sense? Why would anyone use #index BTW ?


On 11 May 2012 16:54, Hardy Ferentschik <hardy at hibernate.org> wrote:
> Really? I would argue differently.
> Let's take the blog example where I only want to index blog entries which are
> published. Adding the interceptor and relying on automatic indexing will not index un-published entries. Great.
> If I, however, want/ have to re-index my blog entries via the API  the interceptor does not apply? Why?
> IMO the interceptor has to apply for automatic index updates as well as explicit index request. Conceptually
> (for a user) there is no difference between explicitly calling FulltextSession#index or auto-indexing. That's
> exactly the type of confusion the user on the forum experienced.
> I think we should change this behavior.
> --Hardy
> On May 11, 2012, at 5:23 PM, Sanne Grinovero wrote:
>> As a user if I were asking to Search *explicitly* to index my entity,
>> I would not be pleased in the framework to override my request... I
>> think the code is correct, maybe it's worth pointing this out at least
>> on #index() javadoc?
>> Sanne
>> On 11 May 2012 14:48, Hardy Ferentschik <hardy at ferentschik.de> wrote:
>>> Hi,
>>> quick question regarding the indexing interceptor. Why is WorkType.Index mapped to IndexingOverride.APPLY_DEFAULT -
>>> https://github.com/hferentschik/hibernate-search/blob/master/hibernate-search-engine/src/main/java/org/hibernate/search/backend/impl/TransactionalWorker.java#L132
>>> Shouldn't it be the same as ADD? Am I missing something? I am asking, because of https://forum.hibernate.org/viewtopic.php?f=9&t=1015173
>>> --Hardy

More information about the hibernate-dev mailing list