lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armbrust, Daniel C." <Armbrust.Dan...@mayo.edu>
Subject Keeping IndexReader up to date
Date Wed, 16 Apr 2003 16:04:48 GMT
Maybe I'm missing something, but doesn't it seem wrong that the IndexReader and Searcher have
no method to identify when their underlying directory has been modified?  Instead, you have
to go all the way down to the Directory, and cache when it was last modified?

It seems like there should be a method that I can call in the IndexReader, that would tell
me whether or not it is up to date.  Then there would be another method I could call to have
it re-read the index, instead of having to throw away the IndexReader, and construct a new
one.

Ideally, I could set a flag to have it handle this itself... When I want to do a search, I
don't care about the details, I just want it to check to make sure it is current, and if not,
reload itself before it performs the search.  This extra overhead could be turned off (or
be off by default) for people that are searching a static index.

I need this feature currently, so am I going about doing it right?

1) cache the lastModifed date of my directory before creating my index reader and searcher
2) before each search, compare this to the current lastModified date of the directory
3) if != trash the searcher and reader, and create new ones


Thanks, 

Dan

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


Mime
View raw message