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; }
rawParams.set(CommonParams.WT, "raw"); req.setParams(rawParams); ContentStreamBase content = new ContentStreamBase.StringStream(dataConfig); rsp.add(RawResponseWriter.CONTENT, content);
streams.add( new ContentStreamBase.StringStream( body ) );
if( strs != null ) { for( final String body : strs ) { ContentStreamBase stream = new ContentStreamBase.StringStream( body ); if( contentType != null ) { stream.setContentType( contentType );
public static void addDoc(String doc, String updateRequestProcessorChain) throws Exception { Map<String, String[]> params = new HashMap<>(); MultiMapSolrParams mmparams = new MultiMapSolrParams(params); params.put(UpdateParams.UPDATE_CHAIN, new String[]{updateRequestProcessorChain}); SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), (SolrParams) mmparams) { }; UpdateRequestHandler handler = new UpdateRequestHandler(); handler.init(null); ArrayList<ContentStream> streams = new ArrayList<>(2); streams.add(new ContentStreamBase.StringStream(doc)); req.setContentStreams(streams); handler.handleRequestBody(req, new SolrQueryResponse()); req.close(); }
public ContentStream getContentStream(UpdateRequest req) throws IOException { return new ContentStreamBase.StringStream(req.getXML()); }
/** * Take a string and make it an iterable ContentStream */ public static Collection<ContentStream> toContentStreams( final String str, final String contentType ) { if( str == null ) return null; ArrayList<ContentStream> streams = new ArrayList<>( 1 ); ContentStreamBase ccc = new ContentStreamBase.StringStream( str ); ccc.setContentType( contentType ); streams.add( ccc ); return streams; }
public ContentStream getContentStream(UpdateRequest req) throws IOException { return new ContentStreamBase.StringStream(req.getXML()); }
public StringStream( String str ) { this(str, detect(str)); }
public StringStream( String str ) { this(str, detect(str)); }
@Override public Collection<ContentStream> getContentStreams() throws IOException { CharArr json = new CharArr(); new SchemaRequestJSONWriter(json).write(getRequestParameters()); return Collections.<ContentStream>singletonList(new ContentStreamBase.StringStream(json.toString())); }
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); } }
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; } }
/** * Take a string and make it an iterable ContentStream */ public static Collection<ContentStream> toContentStreams( final String str, final String contentType ) { if( str == null ) return null; ArrayList<ContentStream> streams = new ArrayList<ContentStream>( 1 ); ContentStreamBase ccc = new ContentStreamBase.StringStream( str ); ccc.setContentType( contentType ); streams.add( ccc ); return streams; }
/** * If an charset is defined (by the contentType) use that, otherwise * use a StringReader */ @Override public Reader getReader() throws IOException { String charset = getCharsetFromContentType( contentType ); return charset == null ? new StringReader( str ) : new InputStreamReader( getStream(), charset ); } }
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; }
/** * Take a string and make it an iterable ContentStream */ public static Collection<ContentStream> toContentStreams( final String str, final String contentType ) { if( str == null ) return null; ArrayList<ContentStream> streams = new ArrayList<>( 1 ); ContentStreamBase ccc = new ContentStreamBase.StringStream( str ); ccc.setContentType( contentType ); streams.add( ccc ); return streams; }
public StreamQueryRequest(SolrQuery q) { super(q, METHOD.POST); String[] bodies = q.remove(CommonParams.STREAM_BODY); if (bodies != null && bodies.length > 0) { String body = StringUtils.join(bodies, " "); this.contentStream = new StringStream(body); } }
public StreamQueryRequest(SolrQuery q) { super(q, METHOD.POST); String[] bodies = q.remove(CommonParams.STREAM_BODY); if (bodies != null && bodies.length > 0) { String body = StringUtils.join(bodies, " "); this.contentStream = new StringStream(body); } }
/** * If an charset is defined (by the contentType) use that, otherwise * use a StringReader */ @Override public Reader getReader() throws IOException { String charset = getCharsetFromContentType( contentType ); return charset == null ? new StringReader( str ) : new InputStreamReader( getStream(), charset ); } }