lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anders Nielsen" <and...@visator.dk>
Subject RE: Using Lucene in a production environment
Date Wed, 03 Oct 2001 10:03:52 GMT
I found the following information very useful, and I suggest it'd be put
somewhere in the documentation.

Regards
Anders Nielsen


-----Original Message-----
From: Doug Cutting [mailto:DCutting@grandcentral.com]
Sent: 2. oktober 2001 23:49
To: 'lucene-user@jakarta.apache.org'
Subject: RE: Using Lucene in a production environment

[..]

The primary synchronization point is during calls to IndexReader.open() and
IndexWriter.close().  Only one thread may be in this at a time.  For that
reason, and for others, one should re-use IndexReader instances.  Since
IndexReader is thread-safe, this is not hard.  One IndexReader per index is
all that you should need at a time.  When the index changes, you should
create a new IndexReader.  The IndexReader.lastModified() method is designed
to make this easy.  The typical use should be to cache a single index reader
per index, check to see if it is out of date each time the cache is
accessed, and replace it when it is.

IndexWriter.close() commits changes.  Aborting without closing will leave
the index locked but otherwise consistent.

Doug


Mime
View raw message