/**Use this to make an exact copy of DocCollection with a new set of Slices and every other property as is * @param slices the new set of Slices * @return the resulting DocCollection */ public DocCollection copyWithSlices(Map<String, Slice> slices){ return new DocCollection(getName(), slices, propMap, router, znodeVersion,znode); }
/**Use this to make an exact copy of DocCollection with a new set of Slices and every other property as is * @param slices the new set of Slices * @return the resulting DocCollection */ public DocCollection copyWithSlices(Map<String, Slice> slices){ return new DocCollection(getName(), slices, propMap, router, znodeVersion,znode); }
private static DocCollection collectionFromObjects(String name, Map<String, Object> objs, Integer version, String znode) { Map<String,Object> props; Map<String,Slice> slices; Map<String,Object> sliceObjs = (Map<String,Object>)objs.get(DocCollection.SHARDS); if (sliceObjs == null) { // legacy format from 4.0... there was no separate "shards" level to contain the collection shards. slices = makeSlices(objs); props = Collections.emptyMap(); } else { slices = makeSlices(sliceObjs); props = new HashMap<>(objs); objs.remove(DocCollection.SHARDS); } Object routerObj = props.get(DocCollection.DOC_ROUTER); 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((String) routerProps.get("name")); } return new DocCollection(name, slices, props, router, version, znode); }
private static DocCollection collectionFromObjects(String name, Map<String, Object> objs, Integer version, String znode) { Map<String,Object> props; Map<String,Slice> slices; Map<String,Object> sliceObjs = (Map<String,Object>)objs.get(DocCollection.SHARDS); if (sliceObjs == null) { // legacy format from 4.0... there was no separate "shards" level to contain the collection shards. slices = Slice.loadAllFromMap(objs); props = Collections.emptyMap(); } else { slices = Slice.loadAllFromMap(sliceObjs); props = new HashMap<>(objs); objs.remove(DocCollection.SHARDS); } Object routerObj = props.get(DocCollection.DOC_ROUTER); 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((String) routerProps.get("name")); } return new DocCollection(name, slices, props, router, version, znode); }