lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject Re: Keeping IndexReader up to date
Date Wed, 16 Apr 2003 16:43:10 GMT
I think having to do this small manual step also gives flexibility to
those who want it.  Not everyone will want their index 'reloaded' every
time it is changed (think very dynamic indices).
As for how to figure out when to get the new IndexSearcher/Reader, yes,
looks right, and I remember posting some code that does just that a few
months ago (3, 4, or more months ago).


--- "Armbrust, Daniel C." <> wrote:
> 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:
> For additional commands, e-mail:

Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo

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

View raw message