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

Distributed Grouping breaks multi valued 'fl' param

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: master (9.0), 8.3
    • Component/s: None
    • Labels:
      None

      Description

      Co-worker discovered a bug with (distributed) grouping when multiple fl params are specified.

      StoredFieldsShardRequestFactory has very (old and) brittle code that assumes there will be 0 or 1 fl params in the original request that it should inspect to see if it needs to append (via string concat) the uniqueKey field onto in order to collate the returned stored fields into their respective (grouped) documents – and then ignores any additional fl params that may exist in the original request when it does so.

      The net result is that only the uniqueKey field and whatever fields are specified in the first fl param specified are fetched from each shard and ultimately returned.

      The only workaround is to replace multiple fl params with a single fl param containing a comma seperated list of the requested fields.


      Bug is trivial to reproduce with bin/solr -e cloud -noprompt by comparing these requests which should all be equivilent...

      $ bin/post -c gettingstarted -out yes example/exampledocs/books.csv
      ...
      $ curl 'http://localhost:8983/solr/gettingstarted/query?omitHeader=true&indent=true&fl=author,name,id&q=*:*&group=true&group.field=genre_s'
      {
        "grouped":{
          "genre_s":{
            "matches":10,
            "groups":[{
                "groupValue":"fantasy",
                "doclist":{"numFound":8,"start":0,"maxScore":1.0,"docs":[
                    {
                      "id":"0812521390",
                      "name":["The Black Company"],
                      "author":["Glen Cook"]}]
                }},
              {
                "groupValue":"scifi",
                "doclist":{"numFound":2,"start":0,"docs":[
                    {
                      "id":"0553293354",
                      "name":["Foundation"],
                      "author":["Isaac Asimov"]}]
                }}]}}}
      $ curl 'http://localhost:8983/solr/gettingstarted/query?omitHeader=true&indent=true&fl=author&fl=name,id&q=*:*&group=true&group.field=genre_s'
      {
        "grouped":{
          "genre_s":{
            "matches":10,
            "groups":[{
                "groupValue":"fantasy",
                "doclist":{"numFound":8,"start":0,"maxScore":1.0,"docs":[
                    {
                      "id":"0812521390",
                      "author":["Glen Cook"]}]
                }},
              {
                "groupValue":"scifi",
                "doclist":{"numFound":2,"start":0,"docs":[
                    {
                      "id":"0553293354",
                      "author":["Isaac Asimov"]}]
                }}]}}}
      $ curl 'http://localhost:8983/solr/gettingstarted/query?omitHeader=true&indent=true&fl=id&fl=author&fl=name&q=*:*&group=true&group.field=genre_s'
      {
        "grouped":{
          "genre_s":{
            "matches":10,
            "groups":[{
                "groupValue":"fantasy",
                "doclist":{"numFound":8,"start":0,"maxScore":1.0,"docs":[
                    {
                      "id":"0553573403"}]
                }},
              {
                "groupValue":"scifi",
                "doclist":{"numFound":2,"start":0,"docs":[
                    {
                      "id":"0553293354"}]
                }}]}}}
      

        Attachments

        1. SOLR-13717.patch
          11 kB
          Chris M. Hostetter
        2. SOLR-13717.patch
          11 kB
          Christine Poerschke

          Activity

            People

            • Assignee:
              hossman Chris M. Hostetter
              Reporter:
              hossman Chris M. Hostetter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: