Lucene - Core
  1. Lucene - Core
  2. LUCENE-6042

CustomScoreQuery Explain differs from the actual score when topLevelBoost is used.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.8
    • Fix Version/s: 4.10.3, 5.0, 6.0
    • Component/s: core/query/scoring
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      CustomScoreQuery.java, doExplain has the following line:

      res.addDetail(new Explanation(getBoost(), "queryBoost"));
      

      This multiplies the custom score query by just the boost of the current query, and not by

      queryWeight=topLevelBoost*getBoost();
      

      which is the value that's actually used during scoring. This leads to drastically different scores in the debug info, relative to the actual score, when the query is a subquery of another one, like a BooleanQuery clause, with a non-1 boost.

      1. CustomScoreQuery.patch
        1 kB
        Denis Lantsman
      2. LUCENE-6042.patch
        16 kB
        Robert Muir

        Activity

        Hide
        Robert Muir added a comment -

        Thanks! At a quick glance, the patch seems correct.
        I think we can test it with some of the infra used for core search tests. The explanations tests are good there.

        Show
        Robert Muir added a comment - Thanks! At a quick glance, the patch seems correct. I think we can test it with some of the infra used for core search tests. The explanations tests are good there.
        Hide
        Robert Muir added a comment -

        Patch with Denis' fix and a test. I moved TestExplanations to test-framework as BaseExplanationTestCase, and made it abstract, since thats what it is, and added simple tests for CustomScoreQuery.

        Tests pass with the fix.

        Show
        Robert Muir added a comment - Patch with Denis' fix and a test. I moved TestExplanations to test-framework as BaseExplanationTestCase, and made it abstract, since thats what it is, and added simple tests for CustomScoreQuery. Tests pass with the fix.
        Hide
        Michael McCandless added a comment -

        +1

        Show
        Michael McCandless added a comment - +1
        Hide
        ASF subversion and git services added a comment -

        Commit 1636552 from Robert Muir in branch 'dev/trunk'
        [ https://svn.apache.org/r1636552 ]

        LUCENE-6042: fix CustomScoreQuery explain to properly factor boost

        Show
        ASF subversion and git services added a comment - Commit 1636552 from Robert Muir in branch 'dev/trunk' [ https://svn.apache.org/r1636552 ] LUCENE-6042 : fix CustomScoreQuery explain to properly factor boost
        Hide
        ASF subversion and git services added a comment -

        Commit 1636555 from Robert Muir in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1636555 ]

        LUCENE-6042: fix CustomScoreQuery explain to properly factor boost

        Show
        ASF subversion and git services added a comment - Commit 1636555 from Robert Muir in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1636555 ] LUCENE-6042 : fix CustomScoreQuery explain to properly factor boost
        Hide
        Robert Muir added a comment -

        Thanks Denis!

        Show
        Robert Muir added a comment - Thanks Denis!
        Hide
        Robert Muir added a comment -

        reopen for backport

        Show
        Robert Muir added a comment - reopen for backport
        Hide
        ASF subversion and git services added a comment -

        Commit 1642625 from Robert Muir in branch 'dev/branches/lucene_solr_4_10'
        [ https://svn.apache.org/r1642625 ]

        LUCENE-6042: fix CustomScoreQuery explain to properly factor boost

        Show
        ASF subversion and git services added a comment - Commit 1642625 from Robert Muir in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1642625 ] LUCENE-6042 : fix CustomScoreQuery explain to properly factor boost
        Hide
        ASF subversion and git services added a comment -

        Commit 1642626 from Robert Muir in branch 'dev/branches/lucene_solr_4_10'
        [ https://svn.apache.org/r1642626 ]

        LUCENE-6042: fix test bug

        Show
        ASF subversion and git services added a comment - Commit 1642626 from Robert Muir in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1642626 ] LUCENE-6042 : fix test bug
        Hide
        ASF subversion and git services added a comment -

        Commit 1643372 from hossman@apache.org in branch 'dev/branches/lucene_solr_4_10'
        [ https://svn.apache.org/r1643372 ]

        LUCENE-6042: 4x only test tweak: supress 3x codec for all tests that subclass this one – needs docvals

        Show
        ASF subversion and git services added a comment - Commit 1643372 from hossman@apache.org in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1643372 ] LUCENE-6042 : 4x only test tweak: supress 3x codec for all tests that subclass this one – needs docvals
        Hide
        Robert Muir added a comment -

        Thank you: i thought failures were maybe ghosts, but i had not suppressed everything affected.

        Show
        Robert Muir added a comment - Thank you: i thought failures were maybe ghosts, but i had not suppressed everything affected.
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Robert Muir
            Reporter:
            Denis Lantsman
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development