Lucene - Core
  1. Lucene - Core
  2. LUCENE-1267

add numDocs() and maxDoc() methods to IndexWriter; deprecate docCount()

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 2.0.0, 2.1, 2.2, 2.3, 2.3.1
    • Fix Version/s: 2.4
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Spinoff from here:

      http://mail-archives.apache.org/mod_mbox/lucene-java-user/200804.mbox/%3c405706.11550.qm@web65411.mail.ac4.yahoo.com%3e

      I think we should add maxDoc() and numDocs() methods to IndexWriter,
      and deprecate docCount() in favor of maxDoc(). To do this I think we
      should cache the deletion count of each segment in the segments file.

      1. LUCENE-1267.patch
        17 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Attached patch.

        This changes the segments file to store the deletion count per
        segment. I added package-private get/setDelCount to SegmentInfo. I
        also added BitVector.getAndSet, which sets the bit but returns the
        starting value of that bit. I use this to only increment deletion
        count if the doc wasn't already deleted.

        I plan to commit in a day or two.

        Show
        Michael McCandless added a comment - Attached patch. This changes the segments file to store the deletion count per segment. I added package-private get/setDelCount to SegmentInfo. I also added BitVector.getAndSet, which sets the bit but returns the starting value of that bit. I use this to only increment deletion count if the doc wasn't already deleted. I plan to commit in a day or two.

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development