SOLR-8860: Remove back-compat handling of router format made in SOLR-4221 in 4.5.0

This commit is contained in:
Shalin Shekhar Mangar 2016-03-17 09:21:30 +05:30
parent 3cdde08ff2
commit ae846bfb49
2 changed files with 11 additions and 18 deletions

View File

@ -61,6 +61,8 @@ Other Changes
* SOLR-7516: Improve javadocs for JavaBinCodec, ObjectResolver and enforce the single-usage policy. * SOLR-7516: Improve javadocs for JavaBinCodec, ObjectResolver and enforce the single-usage policy.
(Jason Gerlowski, Benoit Vanalderweireldt, shalin) (Jason Gerlowski, Benoit Vanalderweireldt, shalin)
* SOLR-8860: Remove back-compat handling of router format made in SOLR-4221 in 4.5.0. (shalin)
================== 6.0.0 ================== ================== 6.0.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -48,33 +48,24 @@ public abstract class DocRouter {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'"); throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'");
} }
protected String getRouteField(DocCollection coll){ protected String getRouteField(DocCollection coll) {
if(coll == null) return null; if (coll == null) return null;
Object o = coll.get(DOC_ROUTER); Map m = (Map) coll.get(DOC_ROUTER);
if (o instanceof String) { if (m == null) return null;
return null;
//old format. cannot have a routefield. Ignore it
}
Map m = (Map) o;
if(m == null) return null;
return (String) m.get("field"); return (String) m.get("field");
} }
public static Map<String,Object> getRouterSpec(ZkNodeProps props){ public static Map<String, Object> getRouterSpec(ZkNodeProps props) {
Map<String,Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
for (String s : props.keySet()) { for (String s : props.keySet()) {
if(s.startsWith("router.")){ if (s.startsWith("router.")) {
map.put(s.substring(7), props.get(s)); map.put(s.substring(7), props.get(s));
} }
} }
Object o = props.get("router"); if (map.get("name") == null) {
if (o instanceof String) {
map.put("name", o);
} else if (map.get("name") == null) {
map.put("name", DEFAULT_NAME); map.put("name", DEFAULT_NAME);
} }
return map; return map;
} }
// currently just an implementation detail... // currently just an implementation detail...