Hi all,
I was writing some extensive unit tests for H.Search configuration parsing when I discovered the following behavior:
I have a SearchTestCase with the following configuration:
Code:
cfg.setProperty( "hibernate.search.Documents.sharding_strategy.nbr_of_shards", "3" );
In this case I get
Code:
searchFactory.getDirectoryProviders(Document.class).length==3
and that's Ok.
Now I add some more options:
Code:
cfg.setProperty( "hibernate.search.Documents.sharding_strategy.nbr_of_shards", "3" );
cfg.setProperty( "hibernate.search.Documents.0.batch.max_merge_docs", "57" );
cfg.setProperty( "hibernate.search.Documents.0.transaction.max_buffered_docs", "58" );
cfg.setProperty( "hibernate.search.Documents.1.batch.max_merge_docs", "57" );
cfg.setProperty( "hibernate.search.Documents.1.transaction.max_buffered_docs", "58" );
cfg.setProperty( "hibernate.search.Documents.2.batch.max_merge_docs", "57" );
cfg.setProperty( "hibernate.search.Documents.2.transaction.max_buffered_docs", "58" );
And I still get 3 DirectoryProviders as expected; If I rewrite the configuration to the following, expecting it as equivalent of the previous one:
Code:
cfg.setProperty( "hibernate.search.Documents.batch.max_merge_docs", "57" );
cfg.setProperty( "hibernate.search.Documents.transaction.max_buffered_docs", "58" );
cfg.setProperty( "hibernate.search.Documents.sharding_strategy.nbr_of_shards", "3" );
It still returns 4 Dir.Providers.
Now adding more options actually make the number of directoryproviders larger!
Ex.:
Code:
cfg.setProperty( "hibernate.search.Documents.batch.merge_factor", "9" );
cfg.setProperty( "hibernate.search.Documents.batch.max_buffered_docs", "9" );
cfg.setProperty( "hibernate.search.Documents.batch.max_merge_docs", "57" );
cfg.setProperty( "hibernate.search.Documents.transaction.max_buffered_docs", "58" );
cfg.setProperty( "hibernate.search.Documents.sharding_strategy.nbr_of_shards", "3" );
This results in
Code:
searchFactory.getDirectoryProviders(Document.class).length==5
which is obviously wrong.
So.. I suppose it is a bug and would open a JIRA for it, but I'm not shure if the "shorthand" configuration I was trying to set was meant to be supported; If not I think an error should be thrown.
I volunteer to fix it myself, but would appreciate some feedback about the intended behavior.
Sanne