title: Performance issues upon transaction completion with Hibernate Search
body: <p>We recently updated from Hibernate Search 3.4 to 5.5.2.
  In the new version, we are experiencing a serious performance hit when adding a new indexed entity which is connected by a foreign key to many other entities, something that did not happen in HS 3.4. When profiling with VisualVM, I see that the bulk of the performance hit is in the method org.hibernate.search.backend.impl.WorkQueue.prepareWorkPlan(), which is called during the commit of the transaction adding the new entity. Ultimately, deep in the call stack, I can see that in the process of enqueueing the new work for lucene for the new entity, there are many calls to initialize lazy collections on the new entities, which is obviously performance heavy due to the many objects connected to it via FK. Again, this is a new behavior in version, 5.5.2 and was not present in 3.4.</p>
  
  <p>Any suggestions? Is this by any chance configurable and I am just missing the configuration? Is there any information that I can add that would help you understand the context?</p>