[ 
https://issues.apache.org/jira/browse/SOLR-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181519#comment-13181519
 ] 

Rob Tulloh commented on SOLR-3010:
----------------------------------

working on trunk. Tried using addContentStream(). This works fine for 1 
document, fails with exception if 2 or more are added to the request:

{noformat}
SEVERE: org.apache.solr.common.SolrException: missing content stream
        at 
org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:53)
        at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at 
org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:244)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1478)
        at 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:353)
        at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:248)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
        at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
        at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
        at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
        at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
{noformat}

My protype script is written in jython and looks like this:

{noformat}
    svr = CommonsHttpSolrServer('http://hostname:8983/solr', None)
    svr.setAllowCompression(True)
    svr.setMaxRetries(3)

    up = ContentStreamUpdateRequest("/update/extract")
    for doc in docs:
        body = doc.getElement("body")
        bodyValue = body.getValue()

        contentType = doc.getElement("mime-type")
        filename = doc.getElement("filename")
        fn = "n/a"
        ct = None;
        if filename is not None:
            fn = str(filename.getValue())
        if contentType is not None:
            ct = str(contentType.getValue())

        ins = SolrByteArrayContentStream(bodyValue, ct, fn)
        up.addContentStream(ins)

    log(time.asctime(),'streams',up.getContentStreams().size())
    params = ModifiableSolrParams()
    params.add("uprefix", ["ignored_"])

    params.add("fmap.content", "body")

    params.add("extractOnly",["true"])
    params.add("extractFormat",["text"])

    up.setParams(params)
   try:
        start = System.currentTimeMillis()
        response = svr.request(up)
        millis = System.currentTimeMillis() - start
        if millis > 30000:
            log(time.asctime(),'Long running attachment (t=',millis,' 
fn=',fn,'type=',ct)
    except:
        log(time.asctime(),'Caught exception handling 
documents',docs,str(sys.exc_info()))

{noformat}

We are using a build from: apache-solr-4.0-2011-11-04_09-29-42.tgz

                
> CLONE - solrj: submitting more than one stream/file via CommonsHttpSolrServer 
> fails
> -----------------------------------------------------------------------------------
>
>                 Key: SOLR-3010
>                 URL: https://issues.apache.org/jira/browse/SOLR-3010
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>    Affects Versions: 1.4.1
>            Reporter: Rob Tulloh
>            Assignee: Hoss Man
>             Fix For: 3.4, 4.0
>
>
> If you are using an HTTP-client (CommonsHttpSolrServer) to connect to Solr, 
> you are unable to push more than one File/Stream over the wire. 
> For example, if you call 
> ContentStreamUpdateRequest.addContentStream()/.addFile() twice to index both 
> files via Tika, you get the following exception at your Solr server:
> 15:48:59 [ERROR] http-8983-1 [org.apache.solr.core.SolrCore] - 
> org.apache.solr.common.SolrException: missing content stream
>       at 
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:49)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
>       at 
> org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:233)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
>       at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>       at 
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>       at java.lang.Thread.run(Thread.java:619)
> Seems that the POST body send by CommonsHttpSolrServer is not correct.
> If you push only one file, everything works as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to