Solr
  1. Solr
  2. SOLR-4134

Cannot "set" multiple values into multivalued field 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
    • Component/s: clients - java, update
    • Labels:
      None

      Description

      I would like to "set" multiple values into a field using partial updates like so:

      List<String> values = new ArrayList<String>();
      values.add("one");
      values.add("two");
      values.add("three");
      doc.setField(field, singletonMap("set", values));
      

      When using the standard XML-based RequestWriter, you end up with a single value that looks like [one, two, three], because of the toString() calls on lines 130 and 132 of ClientUtils. It works properly when using the BinaryRequestWriter.

      1. SOLR-4134.patch
        9 kB
        Shalin Shekhar Mangar
      2. SOLR-4134.patch
        8 kB
        Shalin Shekhar Mangar
      3. SOLR-4134-nolist-fix.patch
        3 kB
        Shalin Shekhar Mangar

        Issue Links

          Activity

          Hide
          Shalin Shekhar Mangar added a comment -

          Hi Erick, a change log entry was added with my first commit.

          Show
          Shalin Shekhar Mangar added a comment - Hi Erick, a change log entry was added with my first commit.
          Hide
          Erik Hatcher added a comment -

          Shalin - can you add a CHANGES entry for this one too so it's easier for others that experience this issue with 4.0 to see that it got fixed in 4.1+? Thanks!

          Show
          Erik Hatcher added a comment - Shalin - can you add a CHANGES entry for this one too so it's easier for others that experience this issue with 4.0 to see that it got fixed in 4.1+? Thanks!
          Hide
          Shalin Shekhar Mangar added a comment -

          Forgot to attach the fix here before committing the fix.

          Show
          Shalin Shekhar Mangar added a comment - Forgot to attach the fix here before committing the fix.
          Hide
          Commit Tag Bot added a comment -

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

          SOLR-4134 – Use List as value type only when multiple values are present in atomic updates

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1426538 SOLR-4134 – Use List as value type only when multiple values are present in atomic updates
          Hide
          Commit Tag Bot added a comment -

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

          SOLR-4134 – Use List as value type only when multiple values are present in atomic updates

          Show
          Commit Tag Bot added a comment - [trunk commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1426537 SOLR-4134 – Use List as value type only when multiple values are present in atomic updates
          Hide
          Yonik Seeley added a comment -

          Reopening - I think this broke increment.

          I added a test here:
          http://svn.apache.org/viewvc?rev=1426373&view=rev

          The increment code ends up trying to parse "[1]" because the XML loader always represents extended info (like atomic updates) as a List<Object>. We should try to preserve as much information as possible and only use a list when there are multiple values (or if list syntax is actually used).

          Show
          Yonik Seeley added a comment - Reopening - I think this broke increment. I added a test here: http://svn.apache.org/viewvc?rev=1426373&view=rev The increment code ends up trying to parse " [1] " because the XML loader always represents extended info (like atomic updates) as a List<Object>. We should try to preserve as much information as possible and only use a list when there are multiple values (or if list syntax is actually used).
          Hide
          Juan Miguel Cejuela added a comment -

          Awesome! Thanks for the great work

          Show
          Juan Miguel Cejuela added a comment - Awesome! Thanks for the great work
          Hide
          Commit Tag Bot added a comment -

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

          SOLR-4134: Added missing @Test annotation on unit test method

          Show
          Commit Tag Bot added a comment - [trunk commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1424909 SOLR-4134 : Added missing @Test annotation on unit test method
          Hide
          Commit Tag Bot added a comment -

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

          SOLR-4134: Added missing @Test annotation on unit test method

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1424911 SOLR-4134 : Added missing @Test annotation on unit test method
          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=1424907

          SOLR-4134: Standard (XML) request writer cannot "set" multiple values into
          multivalued field with partial updates. (Luis Cappa Banda, Will Butler, shalin)

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1424907 SOLR-4134 : Standard (XML) request writer cannot "set" multiple values into multivalued field with partial updates. (Luis Cappa Banda, Will Butler, shalin)
          Hide
          Commit Tag Bot added a comment -

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

          SOLR-4134: Standard (XML) request writer cannot "set" multiple values into
          multivalued field with partial updates. (Luis Cappa Banda, Will Butler, shalin)

          Show
          Commit Tag Bot added a comment - [trunk commit] Shalin Shekhar Mangar http://svn.apache.org/viewvc?view=revision&revision=1424906 SOLR-4134 : Standard (XML) request writer cannot "set" multiple values into multivalued field with partial updates. (Luis Cappa Banda, Will Butler, shalin)
          Hide
          Shalin Shekhar Mangar added a comment -

          Added a test for "add" operation too.

          I'll commit shortly.

          Show
          Shalin Shekhar Mangar added a comment - Added a test for "add" operation too. I'll commit shortly.
          Hide
          Shalin Shekhar Mangar added a comment -

          Patch with test and fix.

          An example of the XML request with this patch for the example given in the issue description would be:

          <field name="multi_ss" update="set">first</field>
          <field name="multi_ss" update="set">second</field>
          <field name="multi_ss" update="set">third</field>
          

          I'll commit this tomorrow.

          Show
          Shalin Shekhar Mangar added a comment - Patch with test and fix. An example of the XML request with this patch for the example given in the issue description would be: <field name= "multi_ss" update= "set" >first</field> <field name= "multi_ss" update= "set" >second</field> <field name= "multi_ss" update= "set" >third</field> I'll commit this tomorrow.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development