List of usage examples for org.apache.solr.client.solrj.request UpdateRequest getDocIterator
public Iterator<SolrInputDocument> getDocIterator()
From source file:org.codelibs.elasticsearch.solr.solr.JavaBinUpdateRequestCodec.java
License:Apache License
/** * Converts an UpdateRequest to a NamedList which can be serialized to the * given OutputStream in the javabin format * * @param updateRequest/*w ww. ja v a 2 s . c o m*/ * the UpdateRequest to be written out * @param os * the OutputStream to which the request is to be written * * @throws IOException * in case of an exception during marshalling or writing to the * stream */ public void marshal(final UpdateRequest updateRequest, final OutputStream os) throws IOException { final NamedList nl = new NamedList(); final NamedList params = solrParamsToNamedList(updateRequest.getParams()); if (updateRequest.getCommitWithin() != -1) { params.add("commitWithin", updateRequest.getCommitWithin()); } Iterator<SolrInputDocument> docIter = null; if (updateRequest.getDocuments() != null) { docIter = updateRequest.getDocuments().iterator(); } if (updateRequest.getDocIterator() != null) { docIter = updateRequest.getDocIterator(); } nl.add("params", params);// 0: params nl.add("delById", updateRequest.getDeleteById()); nl.add("delByQ", updateRequest.getDeleteQuery()); nl.add("docs", docIter); final JavaBinCodec codec = new JavaBinCodec(); codec.marshal(nl, os); }