-->
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.  [ 2 posts ] 
Author Message
 Post subject: Access prop hibernate.search.default.indexBase from java?
PostPosted: Mon May 31, 2010 7:38 am 
Newbie

Joined: Mon May 31, 2010 7:35 am
Posts: 1
Can anybody now how to access (read) property hibernate.search.default.indexBase from java code?
I need that property to show end user index path and for internal lucene search - I am using hibernate search only to fill index.

Thanks for help.


Top
 Profile  
 
 Post subject: Re: Access prop hibernate.search.default.indexBase from java?
PostPosted: Mon May 31, 2010 2:39 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
you can't read the property directly, you could of course load the same resource and parse the properties file.
I'd recommend you get a reference to the correct Reader given the type:

Code:
DirectoryProvider[] directoryProviders = getSearchFactory().getDirectoryProviders( TypeYouWantToSearchFor.class );
IndexReader indexReader = getSearchFactory().getReaderProvider().openReader( directoryProviders );
try {
      IndexSearcher searcher = new IndexSearcher( indexReader );
... using the searcher
}
finally {
      getSearchFactory().getReaderProvider().closeReader( indexReader );
}

this way you get the correct IndexReader even in case you enable sharding or other complex configurations.

_________________
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.  [ 2 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.