lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane James Vaucher <>
Subject Re: Swapping Indexes?
Date Mon, 16 Aug 2004 22:22:20 GMT
I've tried two options that seem to work:

1) Have a singleton that is responsible that will control your searchers. 
This controller can temporarilly redirect your searchers to 
c:/temp/myindex, allowing you to copy you index to c:/myindex. After that 
process completes, your controller can tell your searchers to use 
c:/myindex, allowing you to then erase your temp index.

If you index nightly, you can always *not* erase your tmp dir, your index 
process will do this automatically if you create your IndexWriter with 
the overwrite option. This way, you can have a backup index if there is 
a system failure at some point (like when you copy/move directories).

2) Use an incremental index. Regularly, I scan my files, see if there are 
modification/additions and update my master index. Removing from the 
master index, adding to a temp dir, then merging. I haven't seen any 
weirdness on windows with this process.


On Mon, 16 Aug 2004, Patrick Burleson wrote:

> I've read in the docs about updating an index and its suggestion
> reguarding swapping out indexes with a directory rename.
> Here's my question, how to do this when searches are running live? 
> Say I have a directory that holds the current valid index: 
> C:\myindex
> and when I'm running my nightly process to generate the index, it gets
> temporarily indexed to:
> C:\temp\myindex
> How can I very quickly replace C:\myindex with C:\temp\myindex? 
> I can't simply do a rename since C:\myindex will likely have open
> files. (Gotta love windows)
> And I can't delete all files in myindex, again because of the open files issue. 
> Any ideas?
> Thanks,
> Patrick
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message