Friday, March 5, 2010

Customize your index with hibernate search 3.2

Today I got my hands on a recent snapshot build of hibernate search 3.2. The main thing I'm interested there is the programmatic configuration of the search index, a feature that I have been waiting for a long time.

Every now and then I have requests from users to add field xy to the searchable index. Now I can build an extension to enable my users to add fields by themselves to the index. With some introspection this should be not so hard to build. What I still have to think about is how to make that useable, because we have quite complex object graphs that need to be explored. Guess that will go in a Tree.

I think of reading the configuration from XML, because at configuration time of the EntityManagerFactory I would have to make plain sql connections and thinking of the tree based nature of the thingy xml seems to be the right choice. Maybe build some pojos and serialize them with JAXB.

The pain will be that I need to enable the admins to restart the server by request. Now that goes only through a script (or the tanuki service adapter on windows). I need to recreate the whole index if the configuration has changed, that will take some time. But I don't see how this can be done a less painless way.

Can't wait to find some time to implement that.

No comments:

Using Mapstruct with Protobuf3