lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Wrapping IndexSearcher so that it is safe?
Date Fri, 13 Nov 2009 00:23:56 GMT
On Thu, Nov 12, 2009 at 5:45 PM, Jacob Rhoden <jrhoden@unimelb.edu.au> wrote:
>> 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.

With SearcherManager you also independently decide how frequently to
reopen. But, yes, the more frequently you reopen the more costly it
is.

If you have access to the writer that's making changes, it's more
efficient to get a near real-time reader from it, than committing from
it and reopen the reader.

You should test performance to what refresh rate works best for your
app (and report back if you can!).

>>>>> 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.

Ahh I see.  OK, that makes sense!

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message