-->
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.  [ 10 posts ] 
Author Message
 Post subject: How to access Hibernate Search properties at runtime?
PostPosted: Thu Dec 10, 2009 4:47 am 
Newbie

Joined: Tue Apr 14, 2009 10:03 am
Posts: 7
I configure Hibernate Search via persistence.xml. Is there a way to access those properties at runtime? I need to get the value of hibernate.search.default.indexBase e.g. but haven't found a way yet to access those parameters, is there one?


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Sun Dec 13, 2009 3:46 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Isegrim,
I'm not aware of a direct method to retrieve the full set of properties, but depending on what you need there could be a way to find out what you need.
For example when you plug your own implementation of a DirectoryProvider the initialization method will receive a copy of relevant properties.

What are you needing hibernate.search.default.indexBase for ?

Regards

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Sun Dec 13, 2009 3:57 pm 
Newbie

Joined: Tue Apr 14, 2009 10:03 am
Posts: 7
Whenever our application server starts we want to check if it is neccessary to rebuild (or initially build) the index (because it is a rather lengthy process as we have lots of data). Therefore we'd like to store an info file in the index root directory which contains some metainformation ...


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Sun Dec 13, 2009 4:50 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
You could store any kind of meta-data object, setting the properties to "STORED": when you load it by using projection you'll get what you have stored in the index.
You could even reload the same object from the database and verify if they are containing the same metadata, but even if they are you can't know about other elements in the index.

I'm not sure how you're going to detect if the index is in synch with the database? If you can come up with a clever idea you can contribute that if you like.
Currently we expect that you should know if you need reindexing: you should know if you're deploying a new version of your software (needing reindexing) or if you deleted the index.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Sun Dec 13, 2009 5:00 pm 
Newbie

Joined: Tue Apr 14, 2009 10:03 am
Posts: 7
I like the idea about storing metadata directly in the index, I was just thinking that it is somewhat easier to handle if it is stored directly in a file on disk (easier to access manually). We have no strategy yet that tells us if our index is still in sync with the database. The only thing we do is that we want to store version information of the database (which gets a new version with every structural change) into the index metadata, to have a quick check wether the index is still compatible to the DB (or if we need to reindex).


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Sun Dec 13, 2009 5:09 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Cool I agree doing a quick version check makes sense.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Mon Feb 01, 2010 8:26 pm 
Beginner
Beginner

Joined: Fri Jun 29, 2007 2:19 pm
Posts: 26
Location: Fremont, CA
s.grinovero wrote:
or if you deleted the index.

How do you detect the deletion of indexes. The directory structure gets rebuilt automatically on a reboot. We want to allow deletion of indexes in run time and rebuild them on demand. Can this be done by just blowing away the indexes and rebuild them on restart.

_________________
-shailesh


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Tue Feb 02, 2010 2:33 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Code:
Can this be done by just blowing away the indexes and rebuild them on restart.

Sure.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Tue Feb 02, 2010 3:44 am 
Beginner
Beginner

Joined: Fri Jun 29, 2007 2:19 pm
Posts: 26
Location: Fremont, CA
But how do you know that the indexes have been deleted as the hibernate search recreates the folder on restart. Is there a way to check the sanity of indexes (besides creating some lucene document in the end of it and reading it during startup)?

_________________
-shailesh


Top
 Profile  
 
 Post subject: Re: How to access Hibernate Search properties at runtime?
PostPosted: Tue Feb 02, 2010 8:12 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
well if you delete them I guess you can remember that?
Search won't delete them spontaneously.
Why would you delete them?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.