Skip to content

Instantly share code, notes, and snippets.

@ceocoder
Created April 29, 2011 19:44
Show Gist options
  • Select an option

  • Save ceocoder/948902 to your computer and use it in GitHub Desktop.

Select an option

Save ceocoder/948902 to your computer and use it in GitHub Desktop.
for (int i = 0; i < 2000; i++) {
SolrServer serv = new CommonsHttpSolrServer(
"http://10.10.6.106:8983/solandra/testmulti.test-" + i);
List<SolrInputDocument> sD = new ArrayList<SolrInputDocument>();
for (int j = 0; j < 1000; j++) {
SolrInputDocument doc = new SolrInputDocument();
doc.addField("title", "example.com");
String id = UUID.randomUUID().toString();
doc.addField("url", id);
doc.addField("text", "test text for test qwerty shit");
doc.addField("category",
"doc pdf xls crap d2l pd2 asc bas");
sD.add(doc);
}
try {
logger.info("indexing 1000 docs ");
serv.add(sD);
serv.commit(true, true);
} catch (SolrServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment