You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Stephen Gray <St...@anu.edu.au> on 2006/03/21 05:35:55 UTC

Re-creating IndexSearcher after update

Hi everyone,

I have an application that allows both indexing and searching. I'm using a 
single IndexSearcher shared among all sessions.

I want to re-create the IndexSearcher whenever the index changes, but I'm 
assuming that if I do this bad things will happen to people who may be 
currently running a search, or paging through a Hits collection created by 
a previous search (the javadocs on Searchable.close say that you should not 
call close while using objects like Hits). I could maintain an "open 
searches" variable and check it every second, but I'd still have the 
problem of existing Hits collections.

Could someone tell me the best way to do this?

Any help much appreciated.

Thanks,
Steve


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


Re: Re-creating IndexSearcher after update

Posted by Yonik Seeley <ys...@gmail.com>.
On 3/20/06, Stephen Gray <St...@anu.edu.au> wrote:
> I want to re-create the IndexSearcher whenever the index changes, but I'm
> assuming that if I do this bad things will happen to people who may be
> currently running a search, or paging through a Hits collection created by
> a previous search (the javadocs on Searchable.close say that you should not
> call close while using objects like Hits). I could maintain an "open
> searches" variable and check it every second, but I'd still have the
> problem of existing Hits collections.
>
> Could someone tell me the best way to do this?

Solr uses reference counting on the IndexSearcher to solve this problem.
When a new searcher has finished warming up, it is "registered" to
serve any new requests .  The old searcher hangs around until everyone
is done using it, then it is closed.

-Yonik
http://incubator.apache.org/solr Solr, The Open Source Lucene Search Server

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


RE: Re-creating IndexSearcher after update

Posted by Koji Sekiguchi <ko...@m4.dion.ne.jp>.
Hi Steve,

DelayCloseIndexSearcher may suit your requirement?

Please check:
http://issues.apache.org/jira/browse/LUCENE-445

Hope this helps.

Koji




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