Solr
  1. Solr
  2. SOLR-2277

Update with add and delete combined fails

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: update
    • Labels:
      None

      Description

      The following curl command:
      curl http://127.0.0.1:8983/solr/update/?commit=true -H "Content-Type: text/xml" --data-binary '<add><doc><field name="id">17</field></doc></add><delete><id>1234</id></delete>';

      will trigger the following exception in Solr 1.4.1:
      Dec 9, 2010 12:51:22 PM org.apache.solr.common.SolrException log
      SEVERE: org.apache.solr.common.SolrException: Illegal to have multiple roots (start tag in epilog?).
      at [row,col

      {unknown-source}]: [47,2]
      at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:72)
      at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:54)
      at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
      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.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
      at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:285)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:835)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:641)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:202)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
      at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
      Caused by: com.ctc.wstx.exc.WstxParsingException: Illegal to have multiple roots (start tag in epilog?).
      at [row,col {unknown-source}

      ]: [47,2]
      at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:630)
      at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
      at com.ctc.wstx.sr.BasicStreamReader.handleExtraRoot(BasicStreamReader.java:2155)
      at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2070)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1071)
      at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:90)
      at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:69)
      ... 22 more

        Issue Links

          Activity

          Hide
          Yonik Seeley added a comment -

          If you enclose all the update commands in another element, it should work:

          curl 'http://127.0.0.1:8983/solr/update/?commit=true' -H "Content-Type: text/xml" --data-binary '<update><add><doc><field name="id">17</field></doc></add><delete><id>1234</id></delete></update>'

          Show
          Yonik Seeley added a comment - If you enclose all the update commands in another element, it should work: curl 'http://127.0.0.1:8983/solr/update/?commit=true' -H "Content-Type: text/xml" --data-binary '<update><add><doc><field name="id">17</field></doc></add><delete><id>1234</id></delete></update>'
          Hide
          Markus Jelsma added a comment -

          Ah, an undocumented feature. I've added this to the wiki. I assume this ticket can be closed?
          http://wiki.apache.org/solr/UpdateXmlMessages#Add_and_delete_in_a_single_batch

          Show
          Markus Jelsma added a comment - Ah, an undocumented feature. I've added this to the wiki. I assume this ticket can be closed? http://wiki.apache.org/solr/UpdateXmlMessages#Add_and_delete_in_a_single_batch
          Hide
          Yonik Seeley added a comment -

          Yeah, I think this might have actually worked, long ago when we used XPP as the parser (and we could just treat the message as a series of XML documents, not just one).

          Show
          Yonik Seeley added a comment - Yeah, I think this might have actually worked, long ago when we used XPP as the parser (and we could just treat the message as a series of XML documents, not just one).
          Hide
          Ryan McKinley added a comment -

          FYI, I think it works fine, if you warp the parent with some other tag to make it valid XML...

          <stream>
            <add><doc><field name="id">17</field></doc></add>
            <delete><id>1234</id></delete>
          </stream>
          

          The StreamingUpdateSolrServer starts by writing <stream> and then spits individualy commands from there... finally when it is done, it spits </stream>

          Show
          Ryan McKinley added a comment - FYI, I think it works fine, if you warp the parent with some other tag to make it valid XML... <stream> <add> <doc> <field name= "id" > 17 </field> </doc> </add> <delete> <id> 1234 </id> </delete> </stream> The StreamingUpdateSolrServer starts by writing <stream> and then spits individualy commands from there... finally when it is done, it spits </stream>

            People

            • Assignee:
              Unassigned
              Reporter:
              Markus Jelsma
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development