Class AffinityReplicaListTransformer

  • All Implemented Interfaces:

    public class AffinityReplicaListTransformer
    extends Object
    implements ReplicaListTransformer
    Allows better caching by establishing deterministic evenly-distributed replica routing preferences according to either explicitly configured hash routing parameter, or the hash of a query parameter (configurable, usually related to the main query).
    • Method Detail

      • getInstance

        public static ReplicaListTransformer getInstance​(String dividendParam,
                                                         String hashParam,
                                                         SolrParams requestParams)
        dividendParam - int param to be used directly for mod-based routing
        hashParam - String param to be hashed into an int for mod-based routing
        requestParams - the parameters of the Solr request
        null if specified routing vals are not able to be parsed properly
      • transform

        public <T> void transform​(List<T> choices)
        Description copied from interface: ReplicaListTransformer
        Transforms the passed in list of choices. Transformations can include (but are not limited to) reordering of elements (e.g. via shuffling) and removal of elements (i.e. filtering).
        Specified by:
        transform in interface ReplicaListTransformer
        choices - - a list of choices to transform, typically the choices are Replica objects but choices can also be String objects such as URLs passed in via the ShardParams.SHARDS parameter.