lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: How to find out opened readers in Lucene
Date Tue, 09 Dec 2014 11:41:17 GMT
OK so it sounds like it is still-open readers holding the files open.
You are on Windows?

You might be able to use FilterDirectoryReader to do your custom
wrapping of the SegmentReaders, and then pass that to
Searcher/ReaderManager (though you may have to wait for 5.0 for that).

If you can cutover to Lucene's test-framework, and use
MockDirectoryWrapper in a test case with your application, it will
tell you on close if there are still open files and where they were
opened from ... might give some insight.

Mike McCandless

On Tue, Dec 9, 2014 at 6:34 AM, andi rexha <> wrote:
> Hi Mike,
> thank you for your answer. I do the IW.commit, and the size of the index doesnt change
> As for the SearcherManager, I need to use the SegmentReaders being that I cache information
for each segment, and I initialize it via the MultiReader.
> Thank you!
>> From:
>> Date: Tue, 9 Dec 2014 06:26:40 -0500
>> Subject: Re: How to find out opened readers in Lucene
>> To:
>> Another explanation is you are not calling IndexWriter.commit: older
>> index files  (merged away segments) cannot be deleted until that
>> operation is done.
>> Before doing any changes to your readers, trying calling IW.commit and
>> see if that also frees up the disk space.
>> If it's really that you are failing to close some readers, consider
>> using a SearcherManager: it simplifies managing the readers.
>> Mike McCandless
>> On Tue, Dec 9, 2014 at 5:59 AM, andi rexha <> wrote:
>> > Hi,
>> > I have some IndexReaders and a single IndexWriter opened. I index some
>> > documents, and in the end only one reader should be opened and the old
>> > ones should be closed. The readers should be closed, but when I restart
>> > the system(meaning I restart the IndexWriter), actually the size of the
>> > index in disk shrinks at least by half, meaning that probably some
>> > readers were still opened. Is there any way to figure out the readers
>> > per commit that are still in use in a certain moment?
>> >
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message