Class PropertyRouter

  • All Implemented Interfaces:
    DocRouter

    public class PropertyRouter
    extends Object
    implements DocRouter
    Routes based on a text property field. In this method, the value of some property is hashed and this hash is used to assign the node to a random shard. All nodes with the same property value will be assigned to the same shard. Each shard will duplicate all the ACL information. To use this method, when creating a shard add the new configuration properties:
    • shard.key=cm:creator
    • shard.method=PROPERTY
    • shard.instance=<shard.instance>
    • shard.count=<shard.count>
    It is possible to extract a part of the property value to use for sharding using a regular expression, for example, a year at the start of a string:
    • shard.regex=^\d{4}
    Author:
    Gethin James
    See Also:
    Search Services sharding methods
    • Constructor Detail

      • PropertyRouter

        public PropertyRouter​(String propertyRegEx)
    • Method Detail

      • routeAcl

        public Boolean routeAcl​(int shardCount,
                                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:
        shardCount - 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 shardCount,
                                 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:
        shardCount - 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