Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

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

Shalin Shekhar Mangarae846bfb492f
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<String,Object> getRouterSpec(ZkNodeProps props){
- Map<String,Object> map = new LinkedHashMap<>();
+ public static Map<String, Object> getRouterSpec(ZkNodeProps props) {
+ Map<String, Object> 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...