Issue Details (XML | Word | Printable)

Key: LUCENE-1267
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Michael McCandless
Reporter: Michael McCandless
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Lucene - Java

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

Created: 18/Apr/08 01:56 PM   Updated: 11/Oct/08 12:49 PM
Return to search
Component/s: Index
Affects Version/s: 1.9, 2.0.0, 2.1, 2.2, 2.3, 2.3.1
Fix Version/s: 2.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works LUCENE-1267.patch 2008-04-23 07:52 PM Michael McCandless 17 kB

Lucene Fields: New
Resolution Date: 27/Apr/08 11:11 AM


 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
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.