You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by dsmiley <gi...@git.apache.org> on 2018/10/08 04:11:36 UTC

[GitHub] lucene-solr pull request #455: WIP: SOLR-12638

Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/455#discussion_r223244909
  
    --- Diff: solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateBlockTest.java ---
    @@ -181,6 +182,180 @@ public void testBlockRealTimeGet() throws Exception {
         );
       }
     
    +  @Test
    +  public void testBlockAtomicSet() throws Exception {
    +    SolrInputDocument doc = sdoc("id", "1",
    +        "cat_ss", new String[] {"aaa", "ccc"},
    +        "child1", Collections.singleton(sdoc("id", "2", "cat_ss", "child"))
    +    );
    +    json(doc);
    +    addDoc(adoc(doc), "nested-rtg");
    +
    +    BytesRef rootDocId = new BytesRef("1");
    +    SolrCore core = h.getCore();
    +    SolrInputDocument block = RealTimeGetComponent.getInputDocument(core, rootDocId, true);
    +    // assert block doc has child docs
    +    assertTrue(block.containsKey("child1"));
    +
    +    assertJQ(req("q","id:1")
    +        ,"/response/numFound==0"
    +    );
    +
    +    // commit the changes
    +    assertU(commit());
    +
    +    SolrInputDocument committedBlock = RealTimeGetComponent.getInputDocument(core, rootDocId, true);
    +    BytesRef childDocId = new BytesRef("2");
    +    // ensure the whole block is returned when resolveBlock is true and id of a child doc is provided
    +    assertEquals(committedBlock.toString(), RealTimeGetComponent.getInputDocument(core, childDocId, true).toString());
    +
    +    assertJQ(req("q","id:1")
    +        ,"/response/numFound==1"
    +    );
    +
    +    assertJQ(req("qt","/get", "id","1", "fl","id, cat_ss, child1, [child]")
    +        ,"=={\"doc\":{'id':\"1\"" +
    +            ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" +
    +            "       }}"
    +    );
    +
    +    assertU(commit());
    +
    +    assertJQ(req("qt","/get", "id","1", "fl","id, cat_ss, child1, [child]")
    +        ,"=={\"doc\":{'id':\"1\"" +
    +            ", cat_ss:[\"aaa\",\"ccc\"], child1:[{\"id\":\"2\",\"cat_ss\":[\"child\"]}]" +
    +            "       }}"
    +    );
    +
    +    doc = sdoc("id", "1",
    +        "cat_ss", ImmutableMap.of("set", Arrays.asList("aaa", "bbb")),
    --- End diff --
    
    Minor: in cases where the JDK has alternatives to Guava, use them.  Here, it's `Collections.singletonMap` I recall.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org