Class RoutedAlias
- java.lang.Object
-
- org.apache.solr.cloud.api.collections.RoutedAlias
-
- Direct Known Subclasses:
CategoryRoutedAlias
,DimensionalRoutedAlias
,TimeRoutedAlias
public abstract class RoutedAlias extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RoutedAlias.Action
-
Field Summary
Fields Modifier and Type Field Description static String
CATEGORY
static String
CREATE_COLLECTION_PREFIX
static String
DIMENSIONAL
static Set<String>
MINIMAL_REQUIRED_PARAMS
static String
ROUTED_ALIAS_NAME_CORE_PROP
static String
ROUTER_FIELD
static String
ROUTER_TYPE_NAME
static String
TIME
-
Constructor Summary
Constructors Constructor Description RoutedAlias()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.String
createCollectionsIfRequired(AddUpdateCommand cmd)
Create any required collections and return the name of the collection to which the current document should be sent.static RoutedAlias
fromProps(String aliasName, Map<String,String> props)
Factory method for implementations of this interface.abstract String
getAliasName()
The name of the alias.protected abstract String
getHeadCollectionIfOrdered(AddUpdateCommand cmd)
Calculate the head collection (i.e.abstract Set<String>
getOptionalParams()
abstract Set<String>
getRequiredParams()
static org.apache.solr.common.SolrException
newAliasMustExistException(String aliasName)
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.abstract void
validateRouteValue(AddUpdateCommand cmd)
Check that the value we will be routing on is legal for this type of routed alias.
-
-
-
Field Detail
-
ROUTER_TYPE_NAME
public static final String ROUTER_TYPE_NAME
- See Also:
- Constant Field Values
-
ROUTER_FIELD
public static final String ROUTER_FIELD
- See Also:
- Constant Field Values
-
CREATE_COLLECTION_PREFIX
public static final String CREATE_COLLECTION_PREFIX
- See Also:
- Constant Field Values
-
ROUTED_ALIAS_NAME_CORE_PROP
public static final String ROUTED_ALIAS_NAME_CORE_PROP
- See Also:
- Constant Field Values
-
DIMENSIONAL
public static final String DIMENSIONAL
- See Also:
- Constant Field Values
-
TIME
public static final String TIME
- See Also:
- Constant Field Values
-
CATEGORY
public static final String CATEGORY
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 bygetAliasName()
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
-
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.
-
-