Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8996

maxScore is sometimes missing from distributed grouped responses

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: master (9.0), 8.4
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      This issue occurs when using the grouping feature in distributed mode and sorting by score.

      Each group's docList in the response is supposed to contain a maxScore entry that hold the maximum score for that group. Using the current releases, it sometimes happens that this piece of information is not included:

      {
        "responseHeader": {
          "status": 0,
          "QTime": 42,
          "params": {
            "sort": "score desc",
            "fl": "id,score",
            "q": "_text_:\"72\"",
            "group.limit": "2",
            "group.field": "group2",
            "group.sort": "score desc",
            "group": "true",
            "wt": "json",
            "fq": "group2:72 OR group2:45"
          }
        },
        "grouped": {
          "group2": {
            "matches": 567,
            "groups": [
              {
                "groupValue": 72,
                "doclist": {
                  "numFound": 562,
                  "start": 0,
                  "maxScore": 2.0378063,
                  "docs": [
                    {
                      "id": "29!26551",
                      "score": 2.0378063
                    },
                    {
                      "id": "78!11462",
                      "score": 2.0298104
                    }
                  ]
                }
              },
              {
                "groupValue": 45,
                "doclist": {
                  "numFound": 5,
                  "start": 0,
                  "docs": [
                    {
                      "id": "72!8569",
                      "score": 1.8988966
                    },
                    {
                      "id": "72!14075",
                      "score": 1.5191172
                    }
                  ]
                }
              }
            ]
          }
        }
      }
      

      Looking into the issue, it comes from the fact that if a shard does not contain a document from that group, trying to merge its maxScore with real maxScore entries from other shards is invalid (it results in NaN).

      I'm attaching a patch containing a fix.

        Attachments

        1. lucene_6_5-GroupingMaxScore.patch
          11 kB
          Julien Massenet
        2. lucene_solr_5_3-GroupingMaxScore.patch
          11 kB
          Julien Massenet
        3. LUCENE-8996.02.patch
          3 kB
          Christine Poerschke
        4. LUCENE-8996.03.patch
          5 kB
          Munendra S N
        5. LUCENE-8996.04.patch
          5 kB
          Christine Poerschke
        6. LUCENE-8996.patch
          3 kB
          Christine Poerschke
        7. LUCENE-8996.patch
          2 kB
          Christine Poerschke
        8. master-GroupingMaxScore.patch
          11 kB
          Julien Massenet

          Issue Links

            Activity

              People

              • Assignee:
                cpoerschke Christine Poerschke
                Reporter:
                jmassenet-rakuten Julien Massenet
              • Votes:
                1 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m