Package org.alfresco.solr.tracker
Class DateMonthRouter
java.lang.Object
org.alfresco.solr.tracker.DateMonthRouter
- All Implemented Interfaces:
DocRouter
The date-based sharding assigns dates sequentially through shards based on the month.
For example: If there are 12 shards, each month would be assigned sequentially to each shard, wrapping round and
starting again for each year.
The non-random assignment facilitates easier shard management - dropping shards or scaling out replication for some
date range.
Typical ageing strategies could be based on the created date or destruction date.
Each shard contains copies of all the ACL information, so this information is replicated in each shard.
However, if the property is not present on a node, sharding falls back to the
DBIDRouter to randomly distribute
these nodes.
To use this method, when creating a shard add the new configuration properties:
- shard.key=exif:dateTimeOriginal
- shard.method=DATE
- shard.instance=<shard.instance>
- shard.count=<shard.count>
- shard.date.grouping=3
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetProperties(Optional<org.alfresco.service.namespace.QName> shardProperty) Get additional properties to "shardProperty" depending on the Shard Method.routeAcl(int numShards, int shardInstance, org.alfresco.solr.client.Acl acl) Checks if the incoming ACL document must be indexed on this shard.routeNode(int numShards, int shardInstance, org.alfresco.solr.client.Node node) Checks if the incoming Node must be indexed on this shard.
-
Field Details
-
log
protected static final org.slf4j.Logger log
-
-
Constructor Details
-
DateMonthRouter
Creates a date month router- Parameters:
groupparam- - the number of months that should be grouped together on a shard before moving to use the next shard in sequence
-
-
Method Details
-
routeAcl
Description copied from interface:DocRouterChecks if the incoming ACL document must be indexed on this shard. -
routeNode
Description copied from interface:DocRouterChecks if the incoming Node must be indexed on this shard.- Specified by:
routeNodein interfaceDocRouter- Parameters:
numShards- the total shard count.shardInstance- the owning shard instance (i.e. instance number).node- theNodeinstance.- Returns:
- true if the
Nodeinstance must be indexed in the shard which owns thisDocRouterinstance, false otherwise.
-
getProperties
public Map<String,String> getProperties(Optional<org.alfresco.service.namespace.QName> shardProperty) Description copied from interface:DocRouterGet additional properties to "shardProperty" depending on the Shard Method.- Specified by:
getPropertiesin interfaceDocRouter- Parameters:
shardProperty- custom property used to configure the Router. Note not all routers need that.- Returns:
- pair of key, value
-