Class HashShardingStrategy
- java.lang.Object
-
- org.hibernate.search.backend.lucene.index.impl.HashShardingStrategy
-
- All Implemented Interfaces:
ShardingStrategy
public class HashShardingStrategy extends Object implements ShardingStrategy
-
-
Constructor Summary
Constructors Constructor Description HashShardingStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(ShardingStrategyInitializationContext context)Initializes the sharding strategy.StringtoShardIdentifier(String documentId, String routingKey)Returns the shard identifier corresponding to the given document ID and routing key.Set<String>toShardIdentifiers(Set<String> routingKeys)Returns all the shard identifiers that can be assigned to the given routing keys byShardingStrategy.toShardIdentifier(String, String).
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(ShardingStrategyInitializationContext context)
Description copied from interface:ShardingStrategyInitializes the sharding strategy.- Specified by:
initializein interfaceShardingStrategy- Parameters:
context- The initialization context, giving access to configuration and environment. The sharding strategy is expected to callShardingStrategyInitializationContext.shardIdentifiers(Set).
-
toShardIdentifier
public String toShardIdentifier(String documentId, String routingKey)
Description copied from interface:ShardingStrategyReturns the shard identifier corresponding to the given document ID and routing key.Called in particular when indexing documents.
- Specified by:
toShardIdentifierin interfaceShardingStrategy- Parameters:
documentId- A document identifier. Nevernull.routingKey- A routing key. Nevernull.- Returns:
- A shard identifiers corresponding to the given document ID and routing key. Never
null.
-
toShardIdentifiers
public Set<String> toShardIdentifiers(Set<String> routingKeys)
Description copied from interface:ShardingStrategyReturns all the shard identifiers that can be assigned to the given routing keys byShardingStrategy.toShardIdentifier(String, String).Called in particular when searching.
- Specified by:
toShardIdentifiersin interfaceShardingStrategy- Parameters:
routingKeys- A set of routing keys. Nevernull, never empty.- Returns:
- All the shard identifiers that can be assigned to the given routing keys.
-
-