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

DrillSideways.search yields IllegalArgEx if given IndexReader is empty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.4, 6.0
    • Component/s: modules/facet
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      DrillSideways.create() creates either TopScoreDocCollector or TopFieldCollector with numHits = min(topN, reader.maxDoc()). When the reader is empty, these collectors throw IllegalArgEx that numHits should be > 0. While this is a correct behavior on their part, I think the behavior in DS is wrong. It's an optimization to ask for min(topN, reader.maxDoc(), i.e. if it just delegated topN all was well. So if we'd like to keep the optimization, we should at least make it min(topN,maxDoc+1), because there's nothing technically wrong from running a search against an empty index.

      1. LUCENE-5045.patch
        5 kB
        Shai Erera
      2. LUCENE-5045.patch
        5 kB
        Shai Erera

        Activity

        Hide
        shaie Shai Erera added a comment -

        Patch adds a test which reproduces the problem and fixes DS to modify topN to min(topN,maxDoc) only if maxDoc > 0.

        I intend to commit it shortly.

        Show
        shaie Shai Erera added a comment - Patch adds a test which reproduces the problem and fixes DS to modify topN to min(topN,maxDoc) only if maxDoc > 0. I intend to commit it shortly.
        Hide
        shaie Shai Erera added a comment -

        I made the topN decision just like IndexSearcher.

        Show
        shaie Shai Erera added a comment - I made the topN decision just like IndexSearcher.
        Hide
        mikemccand Michael McCandless added a comment -

        +1, thanks Shai!

        Show
        mikemccand Michael McCandless added a comment - +1, thanks Shai!
        Hide
        shaie Shai Erera added a comment -

        Committed to trunk and 4x.

        Show
        shaie Shai Erera added a comment - Committed to trunk and 4x.
        Hide
        steve_rowe Steve Rowe added a comment -

        Bulk close resolved 4.4 issues

        Show
        steve_rowe Steve Rowe added a comment - Bulk close resolved 4.4 issues

          People

          • Assignee:
            shaie Shai Erera
            Reporter:
            shaie Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development