Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
3.2. Sharding indexes
IndexShardingStrategy. By default, no sharding strategy is enabled, unless the number of shards is configured. To configure the number of shards use the following property
Example 3.3. Enabling index sharding by specifying nbr_of_shards for a specific index
hibernate.search.<indexName>.sharding_strategy.nbr_of_shards 5
IndexShardingStrategy and by setting the following property
Example 3.4. Specifying a custom sharding strategy
hibernate.search.<indexName>.sharding_strategy my.shardingstrategy.Implementation
<indexName>.0 to <indexName>.4. In other words, each shard has the name of it's owning index followed by . (dot) and its index number.
Example 3.5. Configuring the sharding configuration for an example entity Animal
hibernate.search.default.indexBase /usr/lucene/indexes
hibernate.search.Animal.sharding_strategy.nbr_of_shards 5
hibernate.search.Animal.directory_provider org.hibernate.search.store.FSDirectoryProvider
hibernate.search.Animal.0.indexName Animal00
hibernate.search.Animal.3.indexBase /usr/lucene/sharded
hibernate.search.Animal.3.indexName Animal03
FSDirectoryProvider instances and the directory where each subindex is stored is as followed:
- for subindex 0: /usr/lucene/indexes/Animal00 (shared indexBase but overridden indexName)
- for subindex 1: /usr/lucene/indexes/Animal.1 (shared indexBase, default indexName)
- for subindex 2: /usr/lucene/indexes/Animal.2 (shared indexBase, default indexName)
- for subindex 3: /usr/lucene/shared/Animal03 (overridden indexBase, overridden indexName)
- for subindex 4: /usr/lucene/indexes/Animal.4 (shared indexBase, default indexName)