public interface ShardingStrategy
With the exception of the initialize(ShardingStrategyInitializationContext)
method which is invoked only once at startup,
all methods could be invoked in parallel by independent threads.
Implementations must thus be thread-safe.
Ported from Search 5: org.hibernate.search.store.ShardIdentifierProvider.
| Modifier and Type | Method and Description |
|---|---|
void |
initialize(ShardingStrategyInitializationContext context)
Initializes the sharding strategy.
|
String |
toShardIdentifier(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
by
toShardIdentifier(String, String). |
void initialize(ShardingStrategyInitializationContext context)
context - The initialization context, giving access to configuration and environment.
The sharding strategy is expected to call ShardingStrategyInitializationContext.setShardIdentifiers(Set).String toShardIdentifier(String documentId, String routingKey)
Called in particular when indexing documents.
documentId - A document identifier. Never null.routingKey - A routing key. Never null.null.Set<String> toShardIdentifiers(Set<String> routingKeys)
toShardIdentifier(String, String).
Called in particular when searching.
routingKeys - A set of routing keys. Never null, never empty.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.