lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Reuse of IndexReader
Date Wed, 12 Jul 2006 17:01:00 GMT

On Jul 12, 2006, at 12:48 PM, Dominik Bruhn wrote:

> Hy,
> I got the following situation:
> A Servlet runing in Tomcat5. When starting the servlet up it  
> automatically
> creates a IndexReader and stores it in a static variable. For  
> searching this
> variable is used. When adding a document to the index, I create a
> IndexWriter, write the Document, and close the IndexWriter again.
> This leads into a problem: The IndexReader only searches in  
> documents which
> were in the index when the Reader was created. Every Document added
> afterwards is not searched in. When I restart the Servlet I can  
> search in
> those documents.
> Is this a normal behaviour and how can I avoid this?

This is normal behavior.  You'll need to develop some scheme for  
opening a new IndexReader when it is appropriate.  Lots of caveats  
apply.  See Solr for a solid implementation of how this can be done.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message