You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Volodymyr Bychkoviak <vb...@i-hypergrid.com> on 2006/01/19 18:09:59 UTC

getting rid of 'empty' segments

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

Posted by Volodymyr Bychkoviak <vb...@i-hypergrid.com>.
we should not only delete segment but remove it from index structure 
(i.e. SegmentInfos).

Volodymyr Bychkoviak wrote:
> 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 SegmentReader use this code?
>
> Does it all make sense?
>
> 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 as deleting happens in IndexReader can we delete such 'empty' 
>> segments in IndexReader.close()?
>>
>

-- 
regards,
Volodymyr Bychkoviak


Re: getting rid of 'empty' segments

Posted by Volodymyr Bychkoviak <vb...@i-hypergrid.com>.
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 SegmentReader use this code?

Does it all make sense?

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 as deleting happens in IndexReader can we delete such 'empty' 
> segments in IndexReader.close()?
>

-- 
regards,
Volodymyr Bychkoviak


Re: getting rid of 'empty' segments

Posted by Volodymyr Bychkoviak <vb...@i-hypergrid.com>.
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 as deleting happens in IndexReader can we delete such 'empty' 
> segments in IndexReader.close()?
>

-- 
regards,
Volodymyr Bychkoviak


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org