I am using Hibernate Search 4.3 with Multitenant sharding strategy. The indexing work fines and also the indexes are being written one per tenant. However, when I try to re-index by going through a MassIndexer, I see that it deletes all the shards instead of the current shard that is being resolved using Multitenant sharding strategy. After going through the code I find this method in the DynamicShardingStrategy class which get all shards instead of getting the current thread local shard (or one resolved by Sharding Strategy provider)
Code:
@Override
80 public IndexManager[] More ...getIndexManagersForDeletion(Class<?> entity, Serializable id, String idInString) {
81 Set<String> shardIdentifiers = shardIdentifierProvider.getAllShardIdentifiers();
82 return getIndexManagersFromShards( shardIdentifiers );
83 }
Is this by design?
Shouldn't this delete by getting the tenantid instead of all the shards?
How can I overcome this limitation. In my case when I want to recreate an index for a particular shard (which happens to be a tenant) without effecting the other shards.
Thanks