Example usage for org.apache.solr.common SolrInputDocument addChildDocuments

List of usage examples for org.apache.solr.common SolrInputDocument addChildDocuments

Introduction

In this page you can find the example usage for org.apache.solr.common SolrInputDocument addChildDocuments.

Prototype

public void addChildDocuments(Collection<SolrInputDocument> children) 

Source Link

Usage

From source file:org.apache.blur.slur.RowMutationHelperTest.java

License:Apache License

@Test
public void documentWithChildDocumentsShouldBeRowWithRecords() {
    SolrInputDocument doc = new SolrInputDocument();
    doc.addField("rowid", "1");

    List<SolrInputDocument> children = Lists.newArrayList();

    for (int i = 0; i < 10; i++) {
        SolrInputDocument child = new SolrInputDocument();
        child.addField("recordid", i);
        child.addField("fam.key", "value" + i);
        children.add(child);/* w  ww  .ja  v  a 2  s  . c o m*/
    }
    doc.addChildDocuments(children);

    RowMutation mutate = RowMutationHelper.from(doc, "foo");

    assertEquals("Children should turn into records.", 10, mutate.getRecordMutationsSize());
    assertEquals("Should get a simple value back.", "value0", getRecordValue("key", mutate));
    assertEquals("Should properly figure our family.", "fam", getFirstRecord(mutate).getFamily());
}