Solr
  1. Solr
  2. SOLR-4133

Cannot "set" field to null with partial updates when using the standard RequestWriter.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1, 6.0
    • Component/s: clients - java, update
    • Labels:
      None

      Description

      I would like to "unset" a field using partial updates like so:

      doc.setField(field, singletonMap("set", null));
      

      When I attempt to add this document using the standard XML-based RequestWriter, this update is ignored. It works properly when using the BinaryRequestWriter.

      1. SOLR-4133.patch
        3 kB
        Shalin Shekhar Mangar

        Activity

        Hide
        Shalin Shekhar Mangar added a comment -

        Test and fix attached.

        For null values, the xml looks like this:

        <field name="multi_ss" update="set" null="true"/>
        

        Null is not a new attribute. The XML unmarshalling code (XMLLoader.java) already had support for this attribute but it was never actually written by the marshalling code (ClientUtils.java)

        Show
        Shalin Shekhar Mangar added a comment - Test and fix attached. For null values, the xml looks like this: <field name= "multi_ss" update= "set" null = " true " /> Null is not a new attribute. The XML unmarshalling code (XMLLoader.java) already had support for this attribute but it was never actually written by the marshalling code (ClientUtils.java)
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Shalin Shekhar Mangar
        http://svn.apache.org/viewvc?view=revision&revision=1425448

        SOLR-4133: Cannot "set" field to null with partial updates when using the
        standard RequestWriter

        Show
        Commit Tag Bot added a comment - [trunk commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1425448 SOLR-4133 : Cannot "set" field to null with partial updates when using the standard RequestWriter
        Hide
        Shalin Shekhar Mangar added a comment -

        Fixed in trunk and branch_4x.

        Show
        Shalin Shekhar Mangar added a comment - Fixed in trunk and branch_4x.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Shalin Shekhar Mangar
        http://svn.apache.org/viewvc?view=revision&revision=1425449

        SOLR-4133: Cannot set field to null with partial updates when using the standard RequestWriter

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1425449 SOLR-4133 : Cannot set field to null with partial updates when using the standard RequestWriter
        Hide
        Will Butler added a comment -

        Excellent. Thanks for the fix!

        Show
        Will Butler added a comment - Excellent. Thanks for the fix!

          People

          • Assignee:
            Shalin Shekhar Mangar
            Reporter:
            Will Butler
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development