Github user dsmiley commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/385#discussion_r191982413 --- Diff: solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java --- @@ -260,10 +266,90 @@ public void testExceptionThrown() throws Exception { assertQ(req(parent + ":Y"), "//*[@numFound='0']"); assertQ(req(parent + ":W"), "//*[@numFound='0']"); } - + + @Test + public void testSolrNestedFieldsList() throws Exception { + + final String id1 = id(); + List<SolrInputDocument> children1 = Arrays.asList(sdoc("id", id(), child, "y"), sdoc("id", id(), child, "z")); + + SolrInputDocument document1 = sdoc("id", id1, parent, "X", + "children", children1); + + final String id2 = id(); + List<SolrInputDocument> children2 = Arrays.asList(sdoc("id", id(), child, "b"), sdoc("id", id(), child, "c")); + + SolrInputDocument document2 = sdoc("id", id2, parent, "A", + "children", children2); + + List<SolrInputDocument> docs = Arrays.asList(document1, document2); + + indexSolrInputDocumentsDirectly(docs); + + final SolrIndexSearcher searcher = getSearcher(); + assertJQ(req("q","*:*", + "fl","*", + "sort","id asc", + "wt","json"), + "/response/numFound==" + "XyzAbc".length()); + assertJQ(req("q",parent+":" + document2.getFieldValue(parent), + "fl","*", + "sort","id asc", + "wt","json"), + "/response/docs/[0]/id=='" + document2.getFieldValue("id") + "'"); + assertQ(req("q",child+":(y z b c)", "sort","_docid_ asc"), + "//*[@numFound='" + "yzbc".length() + "']", // assert physical order of children + "//doc[1]/arr[@name='child_s']/str[text()='y']", + "//doc[2]/arr[@name='child_s']/str[text()='z']", + "//doc[3]/arr[@name='child_s']/str[text()='b']", + "//doc[4]/arr[@name='child_s']/str[text()='c']"); + assertSingleParentOf(searcher, one("bc"), "A"); + assertSingleParentOf(searcher, one("yz"), "X"); + } + + @Test + public void testSolrNestedFieldsSingleVal() throws Exception { + SolrInputDocument document1 = sdoc("id", id(), parent, "X", + "child1_s", sdoc("id", id(), "child_s", "y"), + "child2_s", sdoc("id", id(), "child_s", "z")); + + SolrInputDocument document2 = sdoc("id", id(), parent, "A", + "child1_s", sdoc("id", id(), "child_s", "b"), + "child2_s", sdoc("id", id(), "child_s", "c")); + + List<SolrInputDocument> docs = new ArrayList<SolrInputDocument>() { --- End diff -- remember to use Arrays.asList
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org