lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ans...@apache.org
Subject lucene-solr:master: SOLR-7123: Syntax modified. Multiple paths can be added in the split parameter itself (pipe separated)
Date Tue, 07 Jun 2016 20:37:00 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 6ffd1ba97 -> 66cd0edc5


SOLR-7123: Syntax modified. Multiple paths can be added in the split parameter itself (pipe
separated)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/66cd0edc
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/66cd0edc
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/66cd0edc

Branch: refs/heads/master
Commit: 66cd0edc52a35fa43182a57c1f3dbfb420334f1e
Parents: 6ffd1ba
Author: Noble Paul <noble@apache.org>
Authored: Tue Jun 7 22:19:09 2016 +0530
Committer: anshum <anshum@apache.org>
Committed: Tue Jun 7 13:31:40 2016 -0700

----------------------------------------------------------------------
 .../src/java/org/apache/solr/handler/loader/JsonLoader.java   | 7 +++----
 .../core/src/test/org/apache/solr/handler/JsonLoaderTest.java | 2 +-
 .../java/org/apache/solr/common/util/JsonRecordReader.java    | 6 +-----
 .../org/apache/solr/common/util/TestJsonRecordReader.java     | 6 ++----
 4 files changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd0edc/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java
----------------------------------------------------------------------
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 ffbfe97..2c5b6ac 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;
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd0edc/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java
----------------------------------------------------------------------
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 a904d9e..7e4d28a 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);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd0edc/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
----------------------------------------------------------------------
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 12c0d83..2025197 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<String>
fieldMappings) {
+  public static JsonRecordReader getInst(String split, List<String> 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<String> fieldMappings)
{
-    return getInst(split, null, fieldMappings);
-  }
 
   private JsonRecordReader() {
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd0edc/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java
----------------------------------------------------------------------
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 e11cc29..9da3bd5 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);


Mime
View raw message