lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Guther" <Andreas.Gut...@markettools.com>
Subject How to re-open the IndexSearcher's IndexReader
Date Fri, 11 May 2007 05:32:32 GMT

Hi,

How can I re-use an IndexSearcher and keep track of changes to the
index?


I am dealing with Index Directories of several GB.  Opening and
IndexSearcher is very expensive and can take several seconds.  Therefore
I am caching the IndexSearcher for re-use.

Our indexes are frequently updated.  Before I pass the IndexSearcher
retrieved from the cache I use the IndexSearcher getIndexReader() method
to get the IndexReader and to check if the IndexReader is current (via
the isCurrent() method).

The isCurrent method is documented as follows:

/**
   * Check whether this IndexReader still works on a current version of
the index.
   * If this is not the case you will need to re-open the IndexReader to
   * make sure you see the latest changes made to the index.
   * 
   * @throws IOException
   */

Opening a new  IndexReader  is trivial.  But then how do I set the
IndexSearcher's reader to the new one without getting a new instance?


Thanks in advance for any help.


Andreas





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