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

CollapseQParserPlugin doesn't propagate needsScores() correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2.1
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      CollapseQParserPlugin internally has a number of Lucene Collector implementations, all of which extend Solr DelegatingCollector which provides a default implementation of the method needsScores() based on what it's delegating too. But Collapsing's collectors fail to consider that these collectors themselves sometimes need the score, irrespective of wether or not a delegate might.

      In most cases nobody would notice this bug because most queries don't seem to care. However, SpanQueries are cranky about this, which will either throw an AssertionError or NPE if you ask for a score without saying in advance you wanted them.

      I have a patch forthcoming, but am having trouble ATM reproducing to create a test. The most straight-forward test doesn't trip it. I have a failing test in a client environment, and a patch that fixes it. Reproducing seems to involve a cached query somehow.

        Issue Links

          Activity

          Hide
          dsmiley David Smiley added a comment -

          Attached is the patch with a test.

          In addition to the SpanQuery, the test needed to incorporate facets (to thus need a DocSet), have caches, and to execute the query twice to execute a different code path the 2nd go around for a successful cache retrieval.

          I also removed the boolean field cscore which is redundant with boolean needsScore. if cscore is true, needsScore certainly is too since the existence of cscore is one of the reasons needsScore can be set to true.

          I plan to commit this once tests pass; it takes awhile.

          Show
          dsmiley David Smiley added a comment - Attached is the patch with a test. In addition to the SpanQuery, the test needed to incorporate facets (to thus need a DocSet), have caches, and to execute the query twice to execute a different code path the 2nd go around for a successful cache retrieval. I also removed the boolean field cscore which is redundant with boolean needsScore. if cscore is true, needsScore certainly is too since the existence of cscore is one of the reasons needsScore can be set to true. I plan to commit this once tests pass; it takes awhile.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit d2fcc3dd7102dca1c4161488a34523df8df9880b in lucene-solr's branch refs/heads/master from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d2fcc3d ]

          SOLR-9494: CollapseQParser's collectors should override needsScores(); can trigger exceptions
          Also, field cscore was not needed.

          Show
          jira-bot ASF subversion and git services added a comment - Commit d2fcc3dd7102dca1c4161488a34523df8df9880b in lucene-solr's branch refs/heads/master from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d2fcc3d ] SOLR-9494 : CollapseQParser's collectors should override needsScores(); can trigger exceptions Also, field cscore was not needed.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit a029c8ede6ae625932a87c38ca7fca1c4402c48f in lucene-solr's branch refs/heads/branch_6x from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a029c8e ]

          SOLR-9494: CollapseQParser's collectors should override needsScores(); can trigger exceptions
          Also, field cscore was not needed.

          (cherry picked from commit d2fcc3d)

          Show
          jira-bot ASF subversion and git services added a comment - Commit a029c8ede6ae625932a87c38ca7fca1c4402c48f in lucene-solr's branch refs/heads/branch_6x from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a029c8e ] SOLR-9494 : CollapseQParser's collectors should override needsScores(); can trigger exceptions Also, field cscore was not needed. (cherry picked from commit d2fcc3d)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 272ceb7c03618b5343ac974e7d54673c8e658121 in lucene-solr's branch refs/heads/branch_6_2 from David Smiley
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=272ceb7 ]

          SOLR-9494: CollapseQParser's collectors should override needsScores(); can trigger exceptions
          Also, field cscore was not needed.

          (cherry picked from commit a029c8e)

          Show
          jira-bot ASF subversion and git services added a comment - Commit 272ceb7c03618b5343ac974e7d54673c8e658121 in lucene-solr's branch refs/heads/branch_6_2 from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=272ceb7 ] SOLR-9494 : CollapseQParser's collectors should override needsScores(); can trigger exceptions Also, field cscore was not needed. (cherry picked from commit a029c8e)
          Hide
          shalinmangar Shalin Shekhar Mangar added a comment -

          Closing after 6.2.1 release

          Show
          shalinmangar Shalin Shekhar Mangar added a comment - Closing after 6.2.1 release

            People

            • Assignee:
              dsmiley David Smiley
              Reporter:
              dsmiley David Smiley
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development