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

        Michael McCandless created issue -
        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.
        Michael McCandless made changes -
        Field Original Value New Value
        Attachment LUCENE-1267.patch [ 12380794 ]
        Michael McCandless made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Michael McCandless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12429344 ] Default workflow, editable Closed status [ 12562612 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12562612 ] jira [ 12583562 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development