java對象轉solrinputdocument代碼 java
SolrClient solrClient= new HttpSolrClient(URL + "/" + core);對象
UpdateRequest req = new UpdateRequest();
req.setAction( UpdateRequest.ACTION.COMMIT, false, false );
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
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); input