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.

        Attachments

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

          Activity

            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: