Package org.apache.solr.common.cloud
Class HashBasedRouter
- java.lang.Object
-
- org.apache.solr.common.cloud.DocRouter
-
- org.apache.solr.common.cloud.HashBasedRouter
-
- Direct Known Subclasses:
CompositeIdRouter
,PlainIdRouter
public abstract class HashBasedRouter extends DocRouter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.common.cloud.DocRouter
DocRouter.Range
-
-
Field Summary
-
Fields inherited from class org.apache.solr.common.cloud.DocRouter
DEFAULT, DEFAULT_NAME
-
-
Constructor Summary
Constructors Constructor Description HashBasedRouter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getId(SolrInputDocument sdoc, SolrParams params)
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.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 informationprotected Slice
hashToSlice(int hash, DocCollection collection)
boolean
isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection)
int
sliceHash(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection)
-
Methods inherited from class org.apache.solr.common.cloud.DocRouter
fromString, fullRange, getDocRouter, getName, getRouteField, getRouterSpec, getSearchRangeSingle, getSearchSlices, partitionRange, partitionRange
-
-
-
-
Method Detail
-
getTargetSlice
public Slice getTargetSlice(String id, SolrInputDocument sdoc, String route, SolrParams params, DocCollection collection)
Description copied from class:DocRouter
Returns the Slice that the document should reside on, or null if there is not enough information- Specified by:
getTargetSlice
in classDocRouter
-
isTargetSlice
public boolean isTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, String shardId, DocCollection collection)
- Specified by:
isTargetSlice
in classDocRouter
-
sliceHash
public int sliceHash(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection)
-
getId
protected String getId(SolrInputDocument sdoc, SolrParams params)
-
hashToSlice
protected Slice hashToSlice(int hash, DocCollection collection)
-
getSearchSlicesSingle
public Collection<Slice> getSearchSlicesSingle(String shardKey, SolrParams params, DocCollection collection)
Description copied from class:DocRouter
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- Specified by:
getSearchSlicesSingle
in classDocRouter
-
-