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

Add toString() or getName() method to IndexReader

    Details

    • Type: Wish
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      It would be very useful for debugging if IndexReader either had a getName() method, or a toString() implementation that would get a string identification for the reader.

      for SegmentReader, this would return the same as getSegmentName()
      for Directory readers, this would return the "generation id"?
      for MultiReader, this could return something like "multi(sub reader name, sub reader name, sub reader name, ...)

      right now, i have to check instanceof for SegmentReader, then call getSegmentName(), and for all other IndexReader types, i would have to do something like get the IndexCommit and get the generation off it (and this may throw UnsupportedOperationException, at which point i have would have to recursively walk sub readers and try again)

      I could work up a patch if others like this idea

        Attachments

        1. LUCENE-1923.patch
          3 kB
          Tim Smith
        2. LUCENE-1923.patch
          8 kB
          Michael McCandless
        3. LUCENE-1923.patch
          6 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              tsmith Tim Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: