lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Rhoden <jrho...@unimelb.edu.au>
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 <jrhoden@unimelb.edu.au 
>>> >
>>> wrote:
>>>>
>>>> The source code for SearcherManager is even downloadable for free:
>>>>  http://www.manning.com/hatcher3/LIAsourcecode.zip
>>>>
>>>> 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
> IndexReader.open), 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,  
ie
10-50 updates per minute, I had assumed (perhaps incorrectly) it would  
be
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,  
the
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  
past
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  
(retainCount==0&&finished==true),
ie when there are no active threads AND close has been requested.

Thanks!
Jacob

____________________________________
Information Technology Services,
The University of Melbourne

Email: jrhoden@unimelb.edu.au
Phone: +61 3 8344 2884
Mobile: +61 4 1095 7575


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