From ae846bfb492fd91e30daac017c6587083e278236 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 17 Mar 2016 09:21:30 +0530 Subject: [PATCH] SOLR-8860: Remove back-compat handling of router format made in SOLR-4221 in 4.5.0 --- solr/CHANGES.txt | 2 ++ .../apache/solr/common/cloud/DocRouter.java | 27 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index ffcfabdee6d..b5aa67078ac 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -61,6 +61,8 @@ Other Changes * SOLR-7516: Improve javadocs for JavaBinCodec, ObjectResolver and enforce the single-usage policy. (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 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java index e64c0649c9d..6fffb3a5a79 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java @@ -48,33 +48,24 @@ public abstract class DocRouter { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown document router '"+ routerName + "'"); } - protected String getRouteField(DocCollection coll){ - if(coll == null) return null; - Object o = coll.get(DOC_ROUTER); - if (o instanceof String) { - return null; - //old format. cannot have a routefield. Ignore it - } - Map m = (Map) o; - if(m == null) return null; + protected String getRouteField(DocCollection coll) { + if (coll == null) return null; + Map m = (Map) coll.get(DOC_ROUTER); + if (m == null) return null; return (String) m.get("field"); - } - public static Map getRouterSpec(ZkNodeProps props){ - Map map = new LinkedHashMap<>(); + public static Map getRouterSpec(ZkNodeProps props) { + Map map = new LinkedHashMap<>(); for (String s : props.keySet()) { - if(s.startsWith("router.")){ + if (s.startsWith("router.")) { map.put(s.substring(7), props.get(s)); } } - Object o = props.get("router"); - if (o instanceof String) { - map.put("name", o); - } else if (map.get("name") == null) { + if (map.get("name") == null) { map.put("name", DEFAULT_NAME); } - return map; + return map; } // currently just an implementation detail...