Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-4294

Solr 4 atomic update incorrect value when setting two or more values to a multivalue via XML update

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • 4.0
    • 4.0.1, 4.1
    • clients - java, update
    • None
    • RHEL

    Description

      Setting multiple values to a multivalued field via an XML atomic update request is resulting in what appears to be the output of a toString() method. See the examples below.

      I ran into this issue using the output for atomic updates from the fix for Solr-4133 to ClientUtils. The server being used is the base 4.0.0 release.

      curl 'https://localhost/solr/update?commit=true' -H 'Content-type:text/xml' -d '
      <add><doc boost="1.0">
      <field name="id">test</field>
      <field name="status" update="set">one</field>
      <field name="status" update="set">two</field>
      </doc></add>'
      

      Yields the following in Solr:

        <arr name="status"><str>{set=one}</str><str>{set=two}</str></arr>
      

      Changing the second "set" to an "add" has the same effect.

      If I only set one value though, it works correctly:

      <add><doc boost="1.0">
      <field name="id">test</field>
      <field name="status" update="set">one</field>
      </doc></add>
      

      Yields:

      <arr name="status"><str>one</str></arr>
      

      It also works fine if I split it into two operations

      <add><doc boost="1.0">
      <field name="id">test</field>
      <field name="status" update="set">one</field>
      </doc></add>
      <add><doc boost="1.0">
      <field name="id">test</field>
      <field name="status" update="add">two</field>
      </doc></add>
      

      Yields:

      <arr name="status"><str>one</str><str>two</str></arr>
      

      Oddly, it works fine as a singe request in JSON:

      curl -k 'http://localhost/solr/update?commit=true' -H 'Content-type:application/json' -d '["id":"test", {"status":{"set":["one", "two"]}}]'
      

      Yields:

      <arr name="status"><str>one</str><str>two</str></arr>
      

      Attachments

        Issue Links

          Activity

            People

              shalin Shalin Shekhar Mangar
              bbpennel Ben Pennell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: