-->
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.  [ 4 posts ] 
Author Message
 Post subject: Changing directory_provider programmaticaly
PostPosted: Thu Nov 03, 2016 5:29 am 
Newbie

Joined: Thu Nov 03, 2016 5:21 am
Posts: 1
Hi,

I just started integrating hibernate-search in the project I'm working on, and we have some special requirements, but I'm not quite sure if this is natively supported in hibernate-search.

We are processing our configuration properties (from for example hibernate.properties) during the startup phase of our application and do some checks and stuff like that. In some cases we have some special cases when we are running tests, to override whatever was set in the properties file.

So my question is, does hibernate-search have any way to set/alter the properties in hibernate.properties after the application starts?

I see there is a way to define different indexes like hibernate.search.<customIndex>.directory_provider, but I don't think I can use that, unless I can change which of these indexes should be used by all entities being indexed.


Top
 Profile  
 
 Post subject: Re: Changing directory_provider programmaticaly
PostPosted: Fri Nov 04, 2016 8:32 am 
Newbie

Joined: Fri Nov 04, 2016 8:04 am
Posts: 1
Hi,
Greetings.

I can assist you. Please add me on Skype - seth.cis.


Top
 Profile  
 
 Post subject: Re: Changing directory_provider programmaticaly
PostPosted: Thu Dec 08, 2016 8:58 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Cisinseth wrote:
Hi,
Greetings.

I can assist you. Please add me on Skype - seth.cis.


Please don't approach good questions like that, if you can help on the forum it might benefit many more people.

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


Top
 Profile  
 
 Post subject: Re: Changing directory_provider programmaticaly
PostPosted: Thu Dec 08, 2016 9:06 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
we can not "alter" the configuration properties, as in some environments they might be read only. For example, some properties might have been set via environment variables.

What can be done is to interpret the configuration properties differently, ignore them or override them, but how to do such things would depend on what you want to accomplish.

For example, you might want to implement a custom DirectoryProvider, and have all your entities (and indexes) use your version by default:

Code:
hibernate.search.default.directory_provider = my.own.DirectoryProviderImplementation


Your my.own.DirectoryProviderImplementation could extend or decorate one of the ones in Hibernate Search, and read / override additional configuration properties as you prefer.

You mentioned testing needs. If you're integrating it in some custom framework, you might want to see org.hibernate.search.cfg.spi.SearchConfiguration; that can be used for fully customizing the boostrap of the Hibernate Search engine; it's more work to use it but you would be able to fully control/set each configuration property as you want, and customize many more internal components.

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