Hi,
here are a couple of comments which might point you into the right direction and clear out some of your questions.
First off, the code you are referring to is based on some contributed wiki content and not something we in the Hibernate team directly recommend and support. Let's look at some of the bits and pieces here.
Quote:
I was expecting that any attachments that we indexed (which were included as "lazy" fields), would get done in a seperate thread.
Why did you think that? Per default indexing happens within the transaction. If you want to index directly you should use the async execution. Even better, however, is to use the mass indexer api (check the online documentation). The mass indexer is explicitly written for indexing large data sets utilizing multiple threads for object loading and indexing. This is the approach I would recommend in your case.
Quote:
Is my understanding of what the lazy boolean does completely wrong, or did i miss something?
It depends what your exact expectations were, but I think they were indeed wrong :-) The lazy option specified is Lucene specific. It allows to load Document field data lazily. This is relevant at search time or when you try to retrieve data from the document. However, it this option is not relevant at indexing time. Think about it, to make something searchable I have to index it. I cannot wait until someone searches for it and then lazily index it ;-) When you want to make your entity and text data searchable you need to access all relevant data there and then. The choice you have is to do it synchronous or asynchronous via the worker configuration or you are using the mass indexer api which gives you a whole bunch of configuration options to fine tune the indexing performance.
Hope this helps,
Hardy