[hibernate-dev] Hibernate search(lucene) update question & opinion.

Mario Ivankovits mario at ops.co.at
Sat Nov 25 02:37:56 EST 2006


Hi Emmanuel!
> Remember that while you can use the same index for your whole domain
> model, One index per entity is the recommended approach. Do you expect
> a finer grained model? Under which partition strategy?
First, I hadn't had the time till now to have a look at Hibernate
Search, so sorry if this is some sort of "newbie question" ....

Yes, I thought of a finer grained model, based on the content of the entity.
Say you have a property named "type" in your entity, based on this type
one might be able to create multiple smaller indexes. Very similar to
what a database can do with partitioned tables.
Now, to avoid any complex annotations we can hand the work to determine
the partition to the DirectoryProvider (which I assume a user has to
provide)

Maybe by simply add the entity as argument to the
directoryProvider.getDirectory() method so the provider could return a
directory based on some sort of complex logic based on the entity.
Then, we need an addition like directoryProvider.getDirectories() and
create a MultiSearcher based on these directories.

Now we can go even further (and I have done this in our Lucene Server).
By caching the version of each of the directories, you are able to
reopen only those indexes which have changed. So if the index changed,
you do not have to open the whole index (which can be really large once
you indexed plenty of text data - I've indexes with 1GB in size).

I hope its clear what I wanted to say, else I can reword .... or even
better ... can come up with a patch :-)

Ciao,
Mario




More information about the hibernate-dev mailing list