List of usage examples for org.apache.solr.client.solrj.embedded EmbeddedSolrServer add
public UpdateResponse add(Collection<SolrInputDocument> docs) throws SolrServerException, IOException
From source file:fr.jetoile.hadoopunit.component.SolrBootstrapTest.java
License:Apache License
private void injectIntoSolr(EmbeddedSolrServer client) throws SolrServerException, IOException { for (int i = 0; i < 1000; ++i) { SolrInputDocument doc = new SolrInputDocument(); doc.addField("cat", "book"); doc.addField("id", "book-" + i); doc.addField("name", "The Legend of the Hobbit part " + i); client.add(doc); if (i % 100 == 0) client.commit(); // periodically flush }//from w ww .ja va2s . c om client.commit(); }