Package org.apache.solr.common.cloud
Class DocRouter
- java.lang.Object
- 
- org.apache.solr.common.cloud.DocRouter
 
- 
- Direct Known Subclasses:
- HashBasedRouter,- ImplicitDocRouter
 
 public abstract class DocRouter extends Object Class to partition int range into n ranges.- WARNING: This API is experimental and might change in incompatible ways in the next release.
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDocRouter.Range
 - 
Field SummaryFields Modifier and Type Field Description static DocRouterDEFAULTstatic StringDEFAULT_NAME
 - 
Constructor SummaryConstructors Constructor Description DocRouter()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DocRouter.RangefromString(String range)DocRouter.RangefullRange()static DocRoutergetDocRouter(String routerName)abstract StringgetName()StringgetRouteField(DocCollection coll)static Map<String,Object>getRouterSpec(ZkNodeProps props)DocRouter.RangegetSearchRangeSingle(String shardKey, SolrParams params, DocCollection collection)This method is consulted to determine what search range (the part of the hash ring) should be queried for a request when an explicit shards' parameter was not used.Collection<Slice>getSearchSlices(String shardKeys, SolrParams params, DocCollection collection)This method is consulted to determine what slices should be queried for a request when an explicit shards' parameter was not used.abstract Collection<Slice>getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection)This method is consulted to determine what slices should be queried for a request when an explicit shards' parameter was not used.abstract SlicegetTargetSlice(String id, SolrInputDocument sdoc, String route, SolrParams params, DocCollection collection)Returns the Slice that the document should reside on, or null if there is not enough informationabstract booleanisTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection)List<DocRouter.Range>partitionRange(int partitions, DocRouter.Range range)Split the range into partitions.List<DocRouter.Range>partitionRange(int partitions, DocRouter.Range range, float fuzz)Split the range into partitions with inexact sizes.
 
- 
- 
- 
Field Detail- 
DEFAULT_NAMEpublic static final String DEFAULT_NAME - See Also:
- Constant Field Values
 
 - 
DEFAULTpublic static final DocRouter DEFAULT 
 
- 
 - 
Method Detail- 
getRouteFieldpublic String getRouteField(DocCollection coll) 
 - 
getRouterSpecpublic static Map<String,Object> getRouterSpec(ZkNodeProps props) 
 - 
fromStringpublic DocRouter.Range fromString(String range) 
 - 
fullRangepublic DocRouter.Range fullRange() 
 - 
partitionRangepublic List<DocRouter.Range> partitionRange(int partitions, DocRouter.Range range) Split the range into partitions.- Parameters:
- partitions- number of partitions
- range- range to split
 
 - 
partitionRangepublic List<DocRouter.Range> partitionRange(int partitions, DocRouter.Range range, float fuzz) Split the range into partitions with inexact sizes.- Parameters:
- partitions- number of partitions
- range- range to split
- fuzz- value between 0 (inclusive) and 0.5 (exclusive) indicating inexact split, i.e. percentage of variation in resulting ranges - odd ranges will be larger and even ranges will be smaller by up to that percentage.
 
 - 
getTargetSlicepublic abstract Slice getTargetSlice(String id, SolrInputDocument sdoc, String route, SolrParams params, DocCollection collection) Returns the Slice that the document should reside on, or null if there is not enough information
 - 
getSearchSlicesSinglepublic abstract Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection) This method is consulted to determine what slices should be queried for a request when an explicit shards' parameter was not used. This method only accepts a single shard key (or null). If you have a comma separated list of shard keys, call getSearchSlices
 - 
getSearchRangeSinglepublic DocRouter.Range getSearchRangeSingle(String shardKey, SolrParams params, DocCollection collection) This method is consulted to determine what search range (the part of the hash ring) should be queried for a request when an explicit shards' parameter was not used. This method only accepts a single shard key (or null).
 - 
isTargetSlicepublic abstract boolean isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection) 
 - 
getNamepublic abstract String getName() 
 - 
getSearchSlicespublic Collection<Slice> getSearchSlices(String shardKeys, SolrParams params, DocCollection collection) This method is consulted to determine what slices should be queried for a request when an explicit shards' parameter was not used. This method accepts a multi-valued shardKeys parameter (normally comma separated from the shard.keys request parameter) and aggregates the slices returned by getSearchSlicesSingle for each shardKey.
 
- 
 
-