[hibernate-issues] [Hibernate-JIRA] Created: (HSEARCH-239) Search default properties are ignored when at least one shard property exist

Rafal Glowacz (JIRA) noreply at atlassian.com
Mon Jul 28 02:50:47 EDT 2008


Search default properties are ignored when at least one shard property exist
----------------------------------------------------------------------------

                 Key: HSEARCH-239
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-239
             Project: Hibernate Search
          Issue Type: Bug
    Affects Versions: 3.0.0.GA
            Reporter: Rafal Glowacz


I'm trying to use shared strategy for search. So my basic setup was:

common.hibernate.search.default.indexBase = /lucene/index
common.hibernate.search.default.optimizer.operation_limit.max = 1000
common.hibernate.search.default.optimizer.transaction_limit.max = 1000
common.hibernate.search.default.directory_provider = org.hibernate.search.store.FSDirectoryProvider
common.hibernate.search.default.sharding_strategy = com.newbay.search.sharding.strategy.IdShardingStrategy

common.hibernate.search.blogentry.sharding_strategy.nbr_of_shards = 5

But this won't work for me because when sharding configuration properties exist then those default ones are completely ignored - I can't understand that. To change this I changed ".default." to ".blogentry." and then I found the bug that the number of properties decides how many shards I want for current index. (nbrOfShards = nbrOfShards >= indexSpecificDefaultProps.size() ?
                          nbrOfShards :
                          indexSpecificDefaultProps.size();)

So in this case I can't do anything. I'm looking for such config:

common.hibernate.search.default.indexBase = /lucene/index
common.hibernate.search.default.optimizer.operation_limit.max = 1000
common.hibernate.search.default.optimizer.transaction_limit.max = 1000
common.hibernate.search.default.directory_provider = org.hibernate.search.store.FSDirectoryProvider
common.hibernate.search.default.sharding_strategy = com.newbay.search.sharding.strategy.IdShardingStrategy

common.hibernate.search.website.sharding_strategy.nbr_of_shards = 2
common.hibernate.search.website.indexBase = /lucene/website
common.hibernate.search.blogentry.sharding_strategy.nbr_of_shards = 5
common.hibernate.search.blogentry.indexBase = /lucene/blogentry

But it doesn't work for now. 

My solution for this is to build properties in order: default, indexProps, shardProps

//sharded
            nbrOfShards = nbrOfShards >= indexSpecificDefaultProps.size() ?
                          nbrOfShards :
                          indexSpecificDefaultProps.size();
            ensureListSize(indexSpecificProps, nbrOfShards);
for (int index = 0; index < nbrOfShards; index++) {
                Properties properties = new Properties();
                properties.putAll(defaultProperties);
                properties.putAll(indexSpecificDefaultProps);
                if (indexSpecificProps.get(index) != null) {
                    properties.putAll(indexSpecificProps.get(index));
                }
                indexSpecificProps.set(index, properties);
            }
            return indexSpecificProps.toArray(new Properties[indexSpecificProps.size()]);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list