Quote:
I understand that Hibernate Search searches the indexed files and proceed to retrieve managed objects from the db based on the ID.
- May I know what is the reason/benefit for such move? to avoid mapping of association since lucene cannot support associations.
The reason is that as result of the search you want to have Hibernate managed objects. Meaning you can edit or delete the returned objects within your sesssion and the changes get persisted back into the db on transaction commit.
Quote:
- How does HS retrieve from the db based on the ID? by batch or individual ID? (would like to know how the db connections, thus, performance affected)
That depends on the query and whether you query a single index or multiple. Generally Search will try to load in batch, for example with a Criteria query using
Restrictions.in.
Quote:
I also understand the use of Projection will enforce the search to only retrieve from indexed files. However, the results would be an array of objects instead of the managed objects. I have found this example that could convert the array of objects back to managed objects
Not quite. The example gives you back objects, but they are not managed, meaning they exist outside the Session scope.
--Hardy