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

Calculating minimum score instead of maximum score in ToParentBlockJoinQuery.BlockJoinScorer.setScoreAndFreq

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0, 6.6
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      We recently upgraded our Elasticsearch cluster from 5.3 to 5.4 and found a bug when we score nested documents.

      I spent some time to check the code from Elasticsearch and Lucene and I found a problem in ToParentBlockJoinQuery.BlockJoinScorer.setScoreAndFreq.

      In the switch statement for the scoreMode in the case "Max" the function Math.min is used and I guess it should be Math.max.

      This would explain our problem in Elasticsearch because we see exactly the problem that instead of the maximum the minimum is returned.

        Issue Links

          Activity

          Show
          selckin selckin added a comment - Adrien Grand https://github.com/apache/lucene-solr/blob/master/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java#L315
          Hide
          jpountz Adrien Grand added a comment -

          Good catch selckin! Would you like to work on a patch + test?

          Show
          jpountz Adrien Grand added a comment - Good catch selckin ! Would you like to work on a patch + test?
          Hide
          selckin selckin added a comment -

          Original poster found it and talked about it on irc with a few of us, i just wanted to highlight it would be an easy fix so it doesn't get lost

          I believe he said he was interested in creating a test for it

          Show
          selckin selckin added a comment - Original poster found it and talked about it on irc with a few of us, i just wanted to highlight it would be an easy fix so it doesn't get lost I believe he said he was interested in creating a test for it
          Hide
          baltendo Bernhard Altendorfer added a comment -

          I would love to try it, but unfortunately I don't have time ..

          Show
          baltendo Bernhard Altendorfer added a comment - I would love to try it, but unfortunately I don't have time ..
          Hide
          jpountz Adrien Grand added a comment -

          No worries, I'll take it.

          Show
          jpountz Adrien Grand added a comment - No worries, I'll take it.
          Hide
          jpountz Adrien Grand added a comment -

          Here is a patch.

          Show
          jpountz Adrien Grand added a comment - Here is a patch.
          Hide
          jimczi Jim Ferenczi added a comment -

          patch looks good, +1

          Show
          jimczi Jim Ferenczi added a comment - patch looks good, +1
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8a88eaf0dc33c4c6ac1f1b6fb499d971345dcb76 in lucene-solr's branch refs/heads/branch_6_6 from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8a88eaf ]

          LUCENE-7833: Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8a88eaf0dc33c4c6ac1f1b6fb499d971345dcb76 in lucene-solr's branch refs/heads/branch_6_6 from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8a88eaf ] LUCENE-7833 : Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 43220c36a0dff4399c2c22e428107be90983efb8 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=43220c3 ]

          LUCENE-7833: Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 43220c36a0dff4399c2c22e428107be90983efb8 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=43220c3 ] LUCENE-7833 : Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 3bb4662e63484eb032e6c1e1a175999869ddff88 in lucene-solr's branch refs/heads/master from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3bb4662 ]

          LUCENE-7833: Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 3bb4662e63484eb032e6c1e1a175999869ddff88 in lucene-solr's branch refs/heads/master from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3bb4662 ] LUCENE-7833 : Fix score computation with ToParentBlockJoinQuery and ScoreMode.MAX.

            People

            • Assignee:
              Unassigned
              Reporter:
              baltendo Bernhard Altendorfer
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development