-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Initializing indexes
PostPosted: Wed Apr 02, 2008 5:39 am 
Newbie

Joined: Wed Apr 02, 2008 5:22 am
Posts: 6
Hi,

I'm started using Hibernate Search with JPA. All looks good, but I'm having trouble finding a nice way to initialize the index on application start-up, and providing a way to rebuild a given index. Maybe not the right place to post, but hopefully someone will have some ideas.

Is there a good design pattern for handling the index initialization in an EJB3 project (on JBoss)? I'd like to have a singleton, that rebuilds the index on application start-up, and also provides a method to rebuild an index for a given entity. The actual code is not a problem, just the pattern.

Also, is it possible to return a list of all the entity classes handled by the EntityManager?

Cheers for any advice.

Anton


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 02, 2008 8:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi Anton,

well, i guess you have seen the manual indexing section in the Hibernate Search Docs (http://www.hibernate.org/hib_docs/search/reference/en/html_single/#search-batchindex). This gives you the how. I recommend to build some sort of admin interface (be it a HTML page, web service or JMX ...) where you could trigger the rebuilding of the indexes, including an initial index. I donĀ“t think there is a general one pattern fits all here. It depends on your overall application architecture. Personally I would not use a singleton, especially since the Singleton pattern comes with its own set of problems. What's about implementing an IndexService class?

Regarding rebuilding the index on each startup - why would you like to do this? Provided you use a file based Lucene index you don't have reindex all the time. Depending on the number and size of the entities you want to index it would also take a lot of time. I would recommend to boostrap the index once via manual indexing and then rely on Hibernate Search's automatic indexing. Then you get the most leverage out of the Hibernate Search. One of the most tedious things to implement yourself is manual index synchronisation.

Ok, I hope this helps you a little with your evaluation.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 07, 2008 7:18 am 
Newbie

Joined: Wed Apr 02, 2008 5:22 am
Posts: 6
Thanks for your help Hardy.

I've managed to get the indexing working, but am now having problems with the search (see http://forum.hibernate.org/viewtopic.php?t=985557).

It works fine running in embedded-jboss for the tests...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.