Example usage for org.apache.solr.client.solrj.embedded EmbeddedSolrServer getById

List of usage examples for org.apache.solr.client.solrj.embedded EmbeddedSolrServer getById

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.embedded EmbeddedSolrServer getById.

Prototype

public SolrDocument getById(String collection, String id) throws SolrServerException, IOException 

Source Link

Document

Retrieves the SolrDocument associated with the given identifier.

Usage

From source file:fr.jetoile.hadoopunit.component.SolrBootstrapTest.java

License:Apache License

@Test
public void solrShouldStart() throws Exception {

    EmbeddedSolrServer client = ((SolrBootstrap) HadoopBootstrap.INSTANCE.getService(Component.SOLR))
            .getClient();/*w w  w  .ja  v  a  2  s  . c om*/

    injectIntoSolr(client);

    SolrDocument collection1 = client
            .getById(configuration.getString(SolrBootstrap.SOLR_COLLECTION_INTERNAL_NAME), "book-1");

    assertNotNull(collection1);

    assertThat(collection1.getFieldValue("name")).isEqualTo("The Legend of the Hobbit part 1");
}