java对象转solrinputdocument代码
SolrClient solrClient= new HttpSolrClient(URL + "/" + core);
UpdateRequest req = new UpdateRequest();
req.setAction( UpdateRequest.ACTION.COMMIT, false, false );
Collection docs = new ArrayList();
for(MasterSolr masterSolr:masterList){
SolrInputDocument doc1=new SolrInputDocument();
DocumentObjectBinder binder=new DocumentObjectBinder();
SolrInputDocument doc=binder.toSolrInputDocument(masterSolr);
docs.add(doc);
}
req.add(docs);
req.setCommitWithin(0);
UpdateResponse rsp = req.process( solrclient);