mirror of https://github.com/apache/lucene.git
SOLR-4221: back compat for router spec
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1526003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b45e8cb708
commit
d038299faf
|
@ -260,8 +260,18 @@ public class ClusterState implements JSONWriter.Writable {
|
||||||
objs.remove(DocCollection.SHARDS);
|
objs.remove(DocCollection.SHARDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map map = (Map) props.get(DocCollection.DOC_ROUTER);
|
Object routerObj = props.get(DocCollection.DOC_ROUTER);
|
||||||
DocRouter router = map == null ? DocRouter.DEFAULT : DocRouter.getDocRouter(map.get("name"));
|
DocRouter router;
|
||||||
|
if (routerObj == null) {
|
||||||
|
router = DocRouter.DEFAULT;
|
||||||
|
} else if (routerObj instanceof String) {
|
||||||
|
// back compat with Solr4.4
|
||||||
|
router = DocRouter.getDocRouter((String)routerObj);
|
||||||
|
} else {
|
||||||
|
Map routerProps = (Map)routerObj;
|
||||||
|
router = DocRouter.getDocRouter(routerProps.get("name"));
|
||||||
|
}
|
||||||
|
|
||||||
return new DocCollection(name, slices, props, router);
|
return new DocCollection(name, slices, props, router);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,13 @@ public abstract class DocRouter {
|
||||||
map.put(s.substring(7), props.get(s));
|
map.put(s.substring(7), props.get(s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(map.get("name") == null) map.put("name", DEFAULT_NAME);
|
Object o = props.get("router");
|
||||||
|
if (o instanceof String) {
|
||||||
|
map.put("name", o);
|
||||||
|
} else if (map.get("name") == null) {
|
||||||
|
map.put("name", DEFAULT_NAME);
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently just an implementation detail...
|
// currently just an implementation detail...
|
||||||
|
|
Loading…
Reference in New Issue