};
}
private void parseAndLoadDocs(SolrQueryRequest req, SolrQueryResponse rsp, InputStream stream,
final UpdateRequestProcessor processor) throws IOException {
UpdateRequest update = null;
update = new JavaBinUpdateRequestCodec().unmarshal(stream,
new JavaBinUpdateRequestCodec.StreamingDocumentHandler() {
private AddUpdateCommand addCmd = null;
public void document(SolrInputDocument document, UpdateRequest updateRequest) {
if (addCmd == null) {
addCmd = getAddCommand(updateRequest.getParams());
}
addCmd.solrDoc = document;
try {
processor.processAdd(addCmd);
addCmd.clear();
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "ERROR adding document " + document);
}
}
});
if (update.getDeleteById() != null) {
delete(update.getDeleteById(), processor, true);
}
if (update.getDeleteQuery() != null) {
delete(update.getDeleteQuery(), processor, false);
}
}