lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Rhoden <>
Subject Re: Wrapping IndexSearcher so that it is safe?
Date Thu, 12 Nov 2009 22:45:43 GMT

On 13/11/2009, at 9:19 AM, Michael McCandless wrote:

>>> On Wed, Nov 11, 2009 at 7:33 PM, Jacob Rhoden < 
>>> >
>>> wrote:
>>>> The source code for SearcherManager is even downloadable for free:
>>>> The example source code does some things that is beyond my level of
>>>> understanding
> SearcherManager can work with a near real-time reader (via
> IndexWriter.getReader), or with a standalone reader (via
>, so that's another source of more complexity vs your
> use case.

There can be quite a large number of updates going on in peak periods,  
10-50 updates per minute, I had assumed (perhaps incorrectly) it would  
better to not work in this way. Perhaps my assumption is wrong?

I assumed that given there could be heaps of updates going on at once,  
IndexSearcher should be manually refreshed as a less frequent  
interval. ie
update every 5 minutes but only if there has been an edit within the  
5 minutes.

>>>> So I am going for something a bit simpler: If a thread wants to  
>>>> use the
>>>> "SafeIndexSearcher", it first calls retain() and then calls  
>>>> release()
>>>> when its done.
> If it starts as 0, then the first search that runs will then close it?
> Is that intended.
> VS keeping a single searcher alive, until its time to reopen (which
> would mean some central place would call retain, and then would call
> release when reopen is done).

Not quite, object is only released when  
ie when there are no active threads AND close has been requested.


Information Technology Services,
The University of Melbourne

Phone: +61 3 8344 2884
Mobile: +61 4 1095 7575

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message