So far, we really haven't had to think much about the timing of when entities are indexed. After all, Hibernate Search is tightly integrated with Hibernate ORM. By default, the add-on updates Lucene whenever the core updates the database.
However, you have the option of decoupling these operations, and indexing manually if you like. Some common situations where you might consider a manual approach are as follows:
If you can easily live with Lucene being out of sync for limited periods, you might want to defer indexing operations until off-peak hours, to reduce system load during times of peak usage.
If you want to use conditional indexing, but are not comfortable with the experimental nature of
EntityIndexingInterceptor
(refer to Chapter 4, Advanced Mapping), you might use manual indexing as an alternative approach.If your database may be updated directly, by processes that do not go through Hibernate ORM, you must manually update your Lucene indexes regularly...