[hibernate-dev] Question regarding Hibernate Search and multiple indexes for same Entity

Aleksander M. Stensby aleksander.stensby at integrasco.no
Sat Feb 23 11:42:03 EST 2008


Hello, my name is Aleksander M. Stensby.
We are currently using Apache Lucene for our full-text indexing/search  
system, but are considering a possible move over to Hibernate Search (or  
possibly Compass).
I've been looking at Hibernate Search and have a question that I hope to  
get some help with here (if this is the right list to ask the question,  
that is.)

We currently have a pretty big and complex database system consisting of  
several "similar" databases. That is, the tables and the table structure  
of each of these X databses are the same, but the content is not, meaning  
it is not a mirroring og sharding system.

What we do at the moment is run X different indexes, each representing a  
different database. The indexing is done by batch jobs running several  
times a day (we have a pretty large flow into our database every day). The  
solution is not very scalable, as we have experienced, and it causes big  
problems if something goes wrong with one of these batch jobs. Also, we  
actually run one of these processes for each database, each dealing with  
its own index. So yeah... a big mess in general.

Since we do use Hibernate, I fell in love with the idéa of Hibernate's  
Event system taking care of this indexing for us, but one big and  
essential question remains:

How can Hibernate "tackle" several different "identical" databases?
I mean, the layout would be something like this:

DB#1
  - TableA
DB#2
  - TableA
DB#X
  - TableA

TableA in DB#1 would refer to entity no.integrasco.xxx.tableA, but so  
would TableA in DB#2, and TableA in DB#X...
So how can we handle indexing of these entities into different indexes?

So that DB#1 - TableA goes into:
/usr/local/lucene/indexes/db1/tableA
DB#2 into
/usr/local/lucene/indexes/db2/tableA
etc..

Is it possible? Maybe I haven't spent enough time on this yet, if the  
answer is simple, please forgive me for wasting your time...

Best Regards,
Aleksander M. Stensby

-- 
Aleksander M. Stensby
Senior Software Developer
Integrasco A/S
aleksander.stensby at integrasco.no
Tlf.: +47 41 22 82 72



More information about the hibernate-dev mailing list