private SolrRequest createtSolrRequest(String json) { final ContentStreamUpdateRequest request = new ContentStreamUpdateRequest(jsonUpdateUrl); final ContentStream cs = new ContentStreamBase.StringStream(json, CONTENT_TYPE); request.addContentStream(cs); if (logger.isDebugEnabled()) { logger.debug("Request generated with JSON: " + json); } return request; }
request.addContentStream(new ContentStreamBase() { @Override public InputStream getStream() throws IOException {
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file) throws IOException { addContentStream(new ContentStreamBase.FileStream(file)); }
private SolrRequest createtSolrRequest(String json) { final ContentStreamUpdateRequest request = new ContentStreamUpdateRequest(jsonUpdateUrl); final ContentStream cs = new ContentStreamBase.StringStream(json, CONTENT_TYPE); request.addContentStream(cs); if (logger.isDebugEnabled()) { logger.debug("Request generated with JSON: " + json); } return request; }
private SolrRequest<UpdateResponse> createSolrRequest(String json) { final ContentStreamUpdateRequest request = new ContentStreamUpdateRequest(jsonUpdateUrl); final ContentStream cs = new ContentStreamBase.StringStream(json, CONTENT_TYPE); request.addContentStream(cs); LOG.debug("Request generated with JSON: {}", json); return request; } }
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file, String contentType) throws IOException { ContentStreamBase cs = new ContentStreamBase.FileStream(file); cs.setContentType(contentType); addContentStream(cs); }
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file, String contentType) throws IOException { ContentStreamBase cs = new ContentStreamBase.FileStream(file); cs.setContentType(contentType); addContentStream(cs); }
private ContentStreamUpdateRequest updateRequest(HtmlResource htmlFile) { try { ContentStreamUpdateRequest updateRequest = new ContentStreamUpdateRequest(configurationProperties.getExtractPath()); updateRequest.addContentStream(new ContentStreamBase.StringStream(htmlFile.getHtml(), "text/html;charset=UTF-8")); updateRequest.setParam(FILE_ID_LITERAL, htmlFile.getResource().getFile().getAbsolutePath()); updateRequest.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); return updateRequest; } catch (IOException ex) { throw new SolrItemWriterException("Could not retrieve filename", ex); } }
request.addContentStream(new ContentStreamBase() { @Override public InputStream getStream() throws IOException {
if (streams != null && !streams.isEmpty()) { ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract"); req.addContentStream(streams);