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

Add json.nl=arrnvp (array of NamedValuePair) style in JSONResponseWriter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 6.4, 7.0
    • Response Writers
    • None

    Description

      The JSONResponseWriter class currently supports several styles of NamedList output format, documented on the wiki at http://wiki.apache.org/solr/SolJSON and in the code at https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java#L71-L76.

      For example the 'arrmap' style:

      NamedList("a"=1,"b"=2,null=3) => [{"a":1},{"b":2},3]
      NamedList("a"=1,"bar”=“foo",null=3.4f) => [{"a":1},{"bar”:”foo"},{3.4}]

      This patch creates a new style ‘arrnvp’ which is an array of named value pairs. For example:

      NamedList("a"=1,"b"=2,null=3) => [{"name":"a","int":1},{"name":"b","int":2},{"int":3}]
      NamedList("a"=1,"bar”=“foo",null=3.4f) => [{"name":"a","int":1},{"name":"b","str":"foo"},{"float":3.4}]

      This style maintains the type information of the values, similar to the xml format:

      <lst name=“someField”>
            <int name=“a”>1</int>
            <str name=“bar”>foo</str>
            <float>3.4</float>
      </lst>

      Attachments

        1. SOLR-9442-arrntv.patch
          9 kB
          Christine Poerschke
        2. SOLR-9442.patch
          3 kB
          Jonny Marks
        3. SOLR-9442.patch
          13 kB
          Jonny Marks
        4. SOLR-9442.patch
          14 kB
          Christine Poerschke

        Issue Links

          Activity

            People

              cpoerschke Christine Poerschke
              jm100 Jonny Marks
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: