diff --git a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java index ffbfe972569..2c5b6ac1dec 100644 --- a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java +++ b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java @@ -125,9 +125,8 @@ public class JsonLoader extends ContentStreamLoader { String path = (String) req.getContext().get(PATH); if (UpdateRequestHandler.DOC_PATH.equals(path) || "false".equals(req.getParams().get("json.command"))) { String split = req.getParams().get("split"); - String childSplit = req.getParams().get("child.split"); String[] f = req.getParams().getParams("f"); - handleSplitMode(split, childSplit, f, reader); + handleSplitMode(split, f, reader); return; } parser = new JSONParser(reader); @@ -194,7 +193,7 @@ public class JsonLoader extends ContentStreamLoader { } } - private void handleSplitMode(String split, String childSplit, String[] fields, final Reader reader) throws IOException { + private void handleSplitMode(String split, String[] fields, final Reader reader) throws IOException { if (split == null) split = "/"; if (fields == null || fields.length == 0) fields = new String[]{"$FQN:/**"}; final boolean echo = "true".equals(req.getParams().get("echo")); @@ -209,7 +208,7 @@ public class JsonLoader extends ContentStreamLoader { } - JsonRecordReader jsonRecordReader = JsonRecordReader.getInst(split, childSplit, Arrays.asList(fields)); + JsonRecordReader jsonRecordReader = JsonRecordReader.getInst(split, Arrays.asList(fields)); jsonRecordReader.streamRecords(parser, new JsonRecordReader.Handler() { ArrayList docs = null; diff --git a/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java b/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java index a904d9ef02e..7e4d28afd65 100644 --- a/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java +++ b/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java @@ -370,7 +370,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 { "b:[{c:c1, e:e1},{c:c2, e :e2, d:{p:q}}]," + "x:y" + "}}"; - req = req("split", "/", "child.split" , "/a/b" ); + req = req("split", "/|/a/b" ); req.getContext().put("path","/update/json/docs"); rsp = new SolrQueryResponse(); p = new BufferingRequestProcessor(null); diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java index 12c0d833500..2025197a005 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java @@ -34,11 +34,10 @@ public class JsonRecordReader { private Node rootNode = new Node("/", (Node) null); - public static JsonRecordReader getInst(String split, String childSplit, List fieldMappings) { + public static JsonRecordReader getInst(String split, List fieldMappings) { JsonRecordReader jsonRecordReader = new JsonRecordReader(); jsonRecordReader.addSplit(split); - if (childSplit != null) jsonRecordReader.addSplit(childSplit); for (String s : fieldMappings) { String path = s; int idx = s.indexOf(':'); @@ -52,9 +51,6 @@ public class JsonRecordReader { return jsonRecordReader; } - public static JsonRecordReader getInst(String split, List fieldMappings) { - return getInst(split, null, fieldMappings); - } private JsonRecordReader() { } diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java index e11cc2953dc..9da3bd50174 100644 --- a/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java +++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java @@ -42,8 +42,6 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 { " {\"c\":\"C2\",\"d\":\"D2\"}\n" + " ]\n" + "}"; -// System.out.println(json); -// All parameters are mapped with field name JsonRecordReader streamer = JsonRecordReader.getInst("/b", Arrays.asList( "a_s:/a", "c_s:/b/c", @@ -208,7 +206,7 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 { "b:{c:d}," + "x:y" + "}}"; - JsonRecordReader streamer = JsonRecordReader.getInst("/", "/a/b", Arrays.asList("/a/x", "/a/b/*")); + JsonRecordReader streamer = JsonRecordReader.getInst("/|/a/b", Arrays.asList("/a/x", "/a/b/*")); streamer.streamRecords(new StringReader(json), (record, path) -> { assertEquals(record.get("x"), "y"); assertEquals(((Map) record.get(null)).get("c"), "d"); @@ -227,7 +225,7 @@ public class TestJsonRecordReader extends SolrTestCaseJ4 { assertEquals(m.get("c"), "c2"); assertEquals(m.get("e"), "e2"); }); - streamer = JsonRecordReader.getInst("/", "/a/b", Arrays.asList("$FQN:/**")); + streamer = JsonRecordReader.getInst("/|/a/b", Arrays.asList("$FQN:/**")); streamer.streamRecords(new StringReader(json), (record, path) -> { assertEquals(record.get("a.x"), "y"); List l = (List) record.get(null);