getting rid of 'empty' segments

2006-01-19 Thread Volodymyr Bychkoviak
if index is updated continuously then in some moment we will have one or more segments in index that have all documents deleted. As long as deleting happens in IndexReader can we delete such 'empty' segments in IndexReader.close()? -- regards, Volodymyr Bychkoviak

Re: getting rid of 'empty' segments

2006-01-19 Thread Volodymyr Bychkoviak
Optimizing is also solution but described approach can save a lot of space and time needed to completely rewrite huge index... Volodymyr Bychkoviak wrote: if index is updated continuously then in some moment we will have one or more segments in index that have all documents deleted. As long a

Re: getting rid of 'empty' segments

2006-01-19 Thread Volodymyr Bychkoviak
followup: in SegmentReader.doCommit() we can add check if (deletedDocs.count()==deletedDocs.size()) { //delete this segment } deleting segment can be done by code that is contained in IndexWriter.deleteSegments(Vector segments) method. Any thoughts about some refactoring to allow SegmentR