lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Shannon" <>
Subject Re: Index File
Date Mon, 15 Nov 2004 19:18:51 GMT
Hi Luke;

I implemented the logging like you said. At present I am speeding about 678
milliseconds creating a new IndexSearcher.

I am going to implement your scheme to resolve this but at a later point
since I don't think this is a huge time factor to be worried about at

Thanks for all your help,


----- Original Message ----- 
From: "Luke Francl" <>
To: "Lucene Users List" <>
Sent: Monday, November 15, 2004 12:18 PM
Subject: Re: Index File

> As long as you are closing your IndexSearchers when you are done with
> them you should not have problems with file handles. When using Lucene
> 1.2 (pre-compound file format) on Windows, I ran into this problem
> because Windows only lets an application open something like 1000 file
> handles. On Unix the number is larger.
> To calculate the cost of creating a new IndexSearcher for each search,
> just put a timing statement around your call to and
> IndexSearcher.close. Your performance cost is the time used when opening
> and closing unnecessarily.
> Here is a description of the scheme I used to manage this issue:
> "Creating a new IndexSearcher for every request opens too many
> files. Searchers are thread-safe, so it is good to keep only one
> Searcher open at a time. However, we must create a new Searcher if
> the index has changed, and it is not safe to close a Searcher while
> it is still in use by a thread. The SearcherManager handles these
> cases.
> The SearcherManager keeps a list of the Searchers which are
> currently in use and returns the the current one, or a new one if
> necessary. The SearcherManager uses a reference counting scheme to
> keep track of which Searchers are still being used. Callers must
> return their Searcher to the SearcherManager when done using it so
> the Searcher can be closed (releasing its filehandles) if no other
> threads are using it and the index has changed."
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message