Thanks Mike, I'm using Windows and it worked just fine, although the procedure is a bit awkward. Why do I have to open a new writer? closing the current one (after switching readers) isn't enough? is it because of deleted documents that need to be updated?
Do you know if it's different in more advanced versions than 2.1 ? Eran. On Thu, Sep 25, 2008 at 12:23 PM, Michael McCandless < [EMAIL PROTECTED]> wrote: > > Are you on Windows? > > If so, you'll need to then open & close a new IndexWriter after the old > reader has switched to the optimized index. That will delete the old files. > > On other OSs, which usually implement "delete on last close", the disk > space should be automatically freed up once you close the old reader. > > Mike > > > Eran Sevi wrote: > > Hi, >> >> I have the following scenario using Lucene 2.1 >> >> 1. Open reader on index to perform some searches. >> 2. Use reader to check if index is optimized. >> 2. Open writer and run optimize() >> 3. Close old reader and open a new reader for further searches. >> >> I expected that after closing the old reader , the index snapshot that was >> created because of the optimize would be removed, but that doesn't happen. >> I remain with X2 index size even though there are not open readers. >> >> If I open a new reader, I guess it uses the new optimized segment because >> isOptimized() returns true. >> I don't want to close all the readers/searchers before optimizing because >> it >> is time consuming and I want to allow searching the index in the meantime >> by >> using the same old reader that was opened before the optimization began.No >> new readers are opened while the index is optimized. >> >> What am I missing in this scenario? >> How can I clear the old redundant files that were used by the reader? >> >> Thanks in advance, >> Eran. >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >