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 "Crump, Michael" <mc...@leadscope.com> on 2004/08/20 16:29:02 UTC

continuous index updates

Hello,

 

I am currently working on a server app that will require the ability to
make index additions/deletions at any time.  I want to cache/reuse index
searchers and readers.  I know that once an index has changed only newly
opened readers will see the changes.  Creating a new reader to see the
changes and caching it will be no problem.  My  problem is that since
this is a multithreaded app other threads may be using the old readers
making it difficult to know when to close them.  I assume that a reader
must be closed to free the associated resources.  I was thinking about
using some kind of reference counted reader that would keep track of its
references and only truly close when there were no references.

 

Am I making this too difficult?

 

Is there a better way?

 

I assume others have had to do this using Lucene, do you have any
recommendations?

 

Regards,

 

Michael


Re: continuous index updates

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I just create a new IndexSearcher, leave the old IndexSearcher alone,
and JVM's garbage collection cleans it up.

Otis

--- "Crump, Michael" <mc...@leadscope.com> wrote:

> Hello,
> 
>  
> 
> I am currently working on a server app that will require the ability
> to
> make index additions/deletions at any time.  I want to cache/reuse
> index
> searchers and readers.  I know that once an index has changed only
> newly
> opened readers will see the changes.  Creating a new reader to see
> the
> changes and caching it will be no problem.  My  problem is that since
> this is a multithreaded app other threads may be using the old
> readers
> making it difficult to know when to close them.  I assume that a
> reader
> must be closed to free the associated resources.  I was thinking
> about
> using some kind of reference counted reader that would keep track of
> its
> references and only truly close when there were no references.
> 
>  
> 
> Am I making this too difficult?
> 
>  
> 
> Is there a better way?
> 
>  
> 
> I assume others have had to do this using Lucene, do you have any
> recommendations?
> 
>  
> 
> Regards,
> 
>  
> 
> Michael
> 
> 


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