org.apache.solr.common.cloud
Class DocRouter

java.lang.Object
  extended by 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 Summary
static class DocRouter.Range
           
 
Field Summary
static DocRouter DEFAULT
           
static String DEFAULT_NAME
           
 
Constructor Summary
DocRouter()
           
 
Method Summary
 DocRouter.Range fromString(String range)
           
 DocRouter.Range fullRange()
           
static DocRouter getDocRouter(Object routerSpec)
           
 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  Slice getTargetSlice(String id, SolrInputDocument sdoc, SolrParams params, DocCollection collection)
          Returns the Slice that the document should reside on, or null if there is not enough information
 List<DocRouter.Range> partitionRange(int partitions, DocRouter.Range range)
          Returns the range for each partition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME

public static final String DEFAULT_NAME
See Also:
Constant Field Values

DEFAULT

public static final DocRouter DEFAULT
Constructor Detail

DocRouter

public DocRouter()
Method Detail

getDocRouter

public static DocRouter getDocRouter(Object routerSpec)

fromString

public DocRouter.Range fromString(String range)

fullRange

public DocRouter.Range fullRange()

partitionRange

public List<DocRouter.Range> partitionRange(int partitions,
                                            DocRouter.Range range)
Returns the range for each partition


getTargetSlice

public abstract Slice getTargetSlice(String id,
                                     SolrInputDocument sdoc,
                                     SolrParams params,
                                     DocCollection collection)
Returns the Slice that the document should reside on, or null if there is not enough information


getSearchSlicesSingle

public 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


getSearchSlices

public 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.



Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.