lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mindaugas Žakšauskas" <>
Subject Re: Reusing same IndexSearcher
Date Wed, 05 Mar 2008 18:15:11 GMT

Thanks for your reply.

I can't think of any way to ensure fair file descriptor usage when
there are many active instances of IndexSearcher (all containing
IndexReader) running. Our project installations tend to run on heavily
loaded sites, where a lot of information is read and written at the
same time.

My original idea was not to operate at IndexReader level, but only
provide a single IndexSearcher (which contains IndexReader).
IndexSearcher being (thread) safe, none of the other code should be
aware of Lucene internals (think encapsulation).

Anyway, if what you saying is correct, I think the Javadoc and FAQ
must be little bit more specific on that. Also, I've looked at the
code of IndexSearcher and could not find a single reason why would
setting a new IndexReader hurt. But that's just probably me having a
hard day.

Can anyone comment if this approach is relevant and would help?


On Wed, Mar 5, 2008 at 5:41 PM, Michael McCandless
<> wrote:
>  Actually you do need to make a new IndexSearcher every time you
>  reopen a new IndexReader.
>  However, that should not lead to leaking file descriptors.  All open
>  files are held by IndexReader (not IndexSearcher), so as long as you
>  are properly closing your IndexReader's you shouldn't use up file
>  descriptors.
>  Mike

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

View raw message