Solr
  1. Solr
  2. SOLR-4036

JSON response writer mangles type in some cases for ExternalFileFields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1
    • Component/s: Response Writers
    • Labels:
      None

      Description

      When using an external file field (containing, say, reads), values in the field can be returned using &fl=field(reads), yielding something like:

      {"response":{"numFound":...,"start":0,"maxScore":1.0,"docs":[

      {"field(reads)":0.0}

      ]}}

      In the response, the field can be renamed to, say, views like this: &fl=views:field(reads), yielding something like:

      {"response":{"numFound":...,"start":0,"maxScore":1.0,"docs":[

      {"views":0.0}

      ]}}

      If, in this case, the field is renamed to reads: &fl=reads:field(reads), the result is now:

      {"response":{"numFound":...,"start":0,"maxScore":1.0,"docs":[

      {"reads":[0.0]}

      ]}}

      (the 0.0 reads are now encapsulated in a list).

      The same problem does not occur in the XML response writer.

      1. SOLR-4036.patch
        1 kB
        Yonik Seeley

        Issue Links

          Activity

          Hide
          Yonik Seeley added a comment -

          I've reproduced something similar w/o external file field.
          It looks like if you are aliasing to a field that exists in the schema, it's picking up multiValued from there.

          For example: fl=abc:id correctly yields single values, while fl=cat:id yields the value in an array.

          Show
          Yonik Seeley added a comment - I've reproduced something similar w/o external file field. It looks like if you are aliasing to a field that exists in the schema, it's picking up multiValued from there. For example: fl=abc:id correctly yields single values, while fl=cat:id yields the value in an array.
          Hide
          Yonik Seeley added a comment -

          Here's a patch that should hopefully fix things.

          Show
          Yonik Seeley added a comment - Here's a patch that should hopefully fix things.
          Hide
          Yonik Seeley added a comment -

          Added test and committed to trunk + 4x
          http://svn.apache.org/viewvc?rev=1408560&view=rev

          Show
          Yonik Seeley added a comment - Added test and committed to trunk + 4x http://svn.apache.org/viewvc?rev=1408560&view=rev
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1408563

          SOLR-4036: field aliases in fl should not cause properties of target field to be used

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1408563 SOLR-4036 : field aliases in fl should not cause properties of target field to be used

            People

            • Assignee:
              Unassigned
              Reporter:
              Martin Koch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development