Package org.apache.solr.common.util

Examples of org.apache.solr.common.util.ContentStream


      " </doc>" +
      "</docs>"
    ).getBytes("ISO-8859-1");
   
    // we declare a content stream without charset:
    final ContentStream cs = new ByteStream(xmlBytes, "application/xml");
   
    ModifiableSolrParams params = new ModifiableSolrParams();
    SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
      @Override
      public Iterable<ContentStream> getContentStreams() {
View Full Code Here


      " </doc>" +
      "</docs>"
    ).getBytes("ISO-8859-1");
   
    // we declare a content stream with charset:
    final ContentStream cs = new ByteStream(xmlBytes, "application/xml; charset=ISO-8859-1");
   
    ModifiableSolrParams params = new ModifiableSolrParams();
    SolrQueryRequest req = new SolrQueryRequestBase(h.getCore(), params) {
      @Override
      public Iterable<ContentStream> getContentStreams() {
View Full Code Here

              }

              if (isMultipart) {
                int i = 0;
                for (ContentStream content : streams) {
                  final ContentStream c = content;

                  String charSet = null;
                  String transferEncoding = null;
                  parts.add(new PartBase(c.getName(), c.getContentType(),
                      charSet, transferEncoding) {
                    @Override
                    protected long lengthOfData() throws IOException {
                      return c.getSize();
                    }

                    @Override
                    protected void sendData(OutputStream out)
                        throws IOException {
                      IOUtils.copy(c.getReader(), out);
                    }
                  });
                }
              }
              if (parts.size() > 0) {
View Full Code Here

  }

  public ContentStream getContentStream(final UpdateRequest request) throws IOException {
    final BAOS baos = new BAOS();
      new JavaBinUpdateRequestCodec().marshal(request, baos);
    return new ContentStream() {
      public String getName() {
        return null;
      }

      public String getSourceInfo() {
View Full Code Here

              }

              if (isMultipart) {
                int i = 0;
                for (ContentStream content : streams) {
                  final ContentStream c = content;

                  String charSet = null;
                  String transferEncoding = null;
                  parts.add(new PartBase(c.getName(), c.getContentType(),
                      charSet, transferEncoding) {
                    @Override
                    protected long lengthOfData() throws IOException {
                      return c.getSize();
                    }

                    @Override
                    protected void sendData(OutputStream out)
                        throws IOException {
                      IOUtils.copy(c.getReader(), out);
                    }
                  });
                }
              }
              if (parts.size() > 0) {
View Full Code Here

    request.setQuery(query);

    boolean showMatch = params.getBool(AnalysisParams.SHOW_MATCH, false);
    request.setShowMatch(showMatch);

    ContentStream stream = extractSingleContentStream(req);
    Reader reader = stream.getReader();
    XMLStreamReader parser = inputFactory.createXMLStreamReader(reader);

    try {

      while (true) {
View Full Code Here

    Iterator<ContentStream> iter = streams.iterator();
    if (!iter.hasNext()) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
              "DocumentAnlysisRequestHandler expects a single content stream with documents to analyze");
    }
    ContentStream stream = iter.next();
    if (iter.hasNext()) {
      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
              "DocumentAnlysisRequestHandler expects a single content stream with documents to analyze");
    }
    return stream;
View Full Code Here

  public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException
  {
    Object obj = response.getValues().get( CONTENT );
    if( obj != null && (obj instanceof ContentStream ) ) {
      // copy the contents to the writer...
      ContentStream content = (ContentStream)obj;
      IOUtils.copy( content.getReader(), writer );
    }
    else {
      getBaseWriter( request ).write( writer, request, response );
    }
  }
View Full Code Here

  public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException
  {
    Object obj = response.getValues().get( CONTENT );
    if( obj != null && (obj instanceof ContentStream ) ) {
      // copy the contents to the writer...
      ContentStream content = (ContentStream)obj;
      Reader reader = content.getReader();
      try {
        IOUtils.copy( reader, writer );
      } finally {
        reader.close();
      }
View Full Code Here

              }

              if (isMultipart) {
                int i = 0;
                for (ContentStream content : streams) {
                  final ContentStream c = content;

                  String charSet = null;
                  String transferEncoding = null;
                  parts.add(new PartBase(c.getName(), c.getContentType(),
                      charSet, transferEncoding) {
                    @Override
                    protected long lengthOfData() throws IOException {
                      return c.getSize();
                    }

                    @Override
                    protected void sendData(OutputStream out)
                        throws IOException {
                      Reader reader = c.getReader();
                      try {
                        IOUtils.copy(reader, out);
                      } finally {
                        reader.close();
                      }
View Full Code Here

TOP

Related Classes of org.apache.solr.common.util.ContentStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.