Class DateMonthRouter

  • All Implemented Interfaces:
    DocRouter

    public class DateMonthRouter
    extends Object
    implements 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>
    Months can be grouped together, for example, by quarter. Each quarter of data would be assigned sequentially through the available shards.
    • shard.date.grouping=3
    See Also:
    Search Services sharding methods
    • Field Detail

      • log

        protected static final org.slf4j.Logger log
    • Constructor Detail

      • DateMonthRouter

        public DateMonthRouter​(String groupparam)
        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 Detail

      • routeAcl

        public Boolean routeAcl​(int numShards,
                                int shardInstance,
                                org.alfresco.solr.client.Acl acl)
        Description copied from interface: DocRouter
        Checks if the incoming ACL document must be indexed on this shard.
        Specified by:
        routeAcl in interface DocRouter
        Parameters:
        numShards - the total shard count.
        shardInstance - the owning shard instance (i.e. instance number).
        acl - the ACL.
        Returns:
        true if the ACL must be indexed in the shard which owns this DocRouter instance, false otherwise.
      • routeNode

        public Boolean routeNode​(int numShards,
                                 int shardInstance,
                                 org.alfresco.solr.client.Node node)
        Description copied from interface: DocRouter
        Checks if the incoming Node must be indexed on this shard.
        Specified by:
        routeNode in interface DocRouter
        Parameters:
        numShards - the total shard count.
        shardInstance - the owning shard instance (i.e. instance number).
        node - the Node instance.
        Returns:
        true if the Node instance must be indexed in the shard which owns this DocRouter instance, false otherwise.
      • getProperties

        public Map<String,​String> getProperties​(Optional<org.alfresco.service.namespace.QName> shardProperty)
        Description copied from interface: DocRouter
        Get additional properties to "shardProperty" depending on the Shard Method.
        Specified by:
        getProperties in interface DocRouter
        Parameters:
        shardProperty - custom property used to configure the Router. Note not all routers need that.
        Returns:
        pair of key, value