I'm new to Lucene.NET but I'm using an open source tool built for Sitecore CMS that uses Lucene.NET to index lots of content from the CMS. I confirmed yesterday that when I rebuild my indexes, the current index files wipe clean so anything that relies on the index gets no data for about 30-60 seconds (the amount of time for a full index rebuild). Is there a best practice or way to make Lucene.NET not overwrite the current index files until the new index is completely rebuilt? I'm basically thinking I'd like it to write to new temp index files and when the rebuild is done have those files overwrite the current index.
Example of what I'm talking about:
- Build fresh index (~30 seconds)
- Index has about 500 documents
- Use code to access data in index and display on website
- Rebuild index (~30 seconds)
- Any code that now reads the index for data returns nothing because the index files are being overwritten; results in website not showing any data
- Rebuild complete: data now available again, data back on website
Thanks in advance