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.
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.
Michael McCandless added a comment - 23/Apr/08 07:52 PM 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.
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.