Class RoutedAlias

java.lang.Object
org.apache.solr.cloud.api.collections.RoutedAlias
Direct Known Subclasses:
CategoryRoutedAlias, DimensionalRoutedAlias, TimeRoutedAlias

public abstract class RoutedAlias extends Object
  • Field Details

  • Constructor Details

    • RoutedAlias

      public RoutedAlias()
  • Method Details

    • newAliasMustExistException

      public static org.apache.solr.common.SolrException newAliasMustExistException(String aliasName)
    • fromProps

      public static RoutedAlias fromProps(String aliasName, Map<String,String> props) throws org.apache.solr.common.SolrException
      Factory method for implementations of this interface. There should be no reason to construct instances elsewhere, and routed alias types are encouraged to have package private constructors.
      Parameters:
      aliasName - The alias name (will be returned by getAliasName()
      props - The properties from an overseer message.
      Returns:
      An implementation appropriate for the supplied properties, or null if no type is specified.
      Throws:
      org.apache.solr.common.SolrException - If the properties are invalid or the router type is unknown.
    • updateParsedCollectionAliases

      public abstract boolean updateParsedCollectionAliases(org.apache.solr.common.cloud.ZkStateReader zkStateReader, boolean conextualize)
      Ensure our parsed version of the alias collection list is up to date. If it was modified, return true. Note that this will return true if some other alias was modified or if properties were modified. These are spurious and the caller should be written to be tolerant of no material changes.
    • getAliasName

      public abstract String getAliasName()
      The name of the alias. This name is used in place of a collection name for both queries and updates.
      Returns:
      The name of the Alias.
    • validateRouteValue

      public abstract void validateRouteValue(AddUpdateCommand cmd) throws org.apache.solr.common.SolrException
      Check that the value we will be routing on is legal for this type of routed alias.
      Parameters:
      cmd - the command containing the document
      Throws:
      org.apache.solr.common.SolrException
    • createCollectionsIfRequired

      public String createCollectionsIfRequired(AddUpdateCommand cmd)
      Create any required collections and return the name of the collection to which the current document should be sent.
      Parameters:
      cmd - The command that might cause collection creation
      Returns:
      The name of the proper destination collection for the document which may or may not be a newly created collection
    • getRequiredParams

      public abstract Set<String> getRequiredParams()
    • getOptionalParams

      public abstract Set<String> getOptionalParams()
    • getHeadCollectionIfOrdered

      protected abstract String getHeadCollectionIfOrdered(AddUpdateCommand cmd)
      Calculate the head collection (i.e. the most recent one for a TRA) if this routed alias has an implicit order, or if the collection is unordered return the appropriate collection name for the value in the current document. This method should never return null.
    • calculateActions

      protected abstract List<RoutedAlias.Action> calculateActions(String targetCol)
      Determine the combination of adds/deletes implied by the arrival of a document destined for the specified collection.
      Parameters:
      targetCol - the collection for which a document is destined.
      Returns:
      A list of actions across the DRA.