mirror of https://github.com/apache/lucene.git
SOLR-6116: Refactor DocRouter.getDocRouter to accept routerName as a String
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1598212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc199eb1af
commit
a627b55bcd
|
@ -174,6 +174,8 @@ Other Changes
|
||||||
recovery scenarios after the leader receives an error trying to forward an
|
recovery scenarios after the leader receives an error trying to forward an
|
||||||
update request to a replica. (Timothy Potter)
|
update request to a replica. (Timothy Potter)
|
||||||
|
|
||||||
|
* SOLR-6116: Refactor DocRouter.getDocRouter to accept routerName as a String. (shalin)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class ClusterState implements JSONWriter.Writable {
|
||||||
router = DocRouter.getDocRouter((String)routerObj);
|
router = DocRouter.getDocRouter((String)routerObj);
|
||||||
} else {
|
} else {
|
||||||
Map routerProps = (Map)routerObj;
|
Map routerProps = (Map)routerObj;
|
||||||
router = DocRouter.getDocRouter(routerProps.get("name"));
|
router = DocRouter.getDocRouter((String) routerProps.get("name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DocCollection(name, slices, props, router, version);
|
return new DocCollection(name, slices, props, router, version);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public abstract class DocRouter {
|
||||||
public static final DocRouter DEFAULT = new CompositeIdRouter();
|
public static final DocRouter DEFAULT = new CompositeIdRouter();
|
||||||
|
|
||||||
|
|
||||||
public static DocRouter getDocRouter(Object routerName) {
|
public static DocRouter getDocRouter(String routerName) {
|
||||||
DocRouter router = routerMap.get(routerName);
|
DocRouter router = routerMap.get(routerName);
|
||||||
if (router != null) return router;
|
if (router != null) return router;
|
||||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'");
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'");
|
||||||
|
|
Loading…
Reference in New Issue