I use Lucene search engine to index some address data. I use MMapDirectory to store the index. Now I want to use my old cache while creating a new one. Do I need to copy my old cache into the other directory? Or maybe is there any good way to do this? I wonder if create parameter in IndexWriter contructor is done for that reason, but don’t actually know how to use it correctly and if it provides “real-time searching”.
I use Lucene search engine to index some address data. I use MMapDirectory to
Share
If your question is: Can I update my existing index with an IndexWriter while IndexSearchers search the current index, prior to the modifications, the answer is yes.
IndexSearchers opened prior to the IndexWriter.Commit() will see the index as it was prior to the modifications, only IndexSearchers opened after the Commit will see changes.
The create parameter on the IndexWriter simply tells it to create the Directory if it does not exist, it will also overwrite an existing index at the specified location.
For realtime searching, this is done by using the IndexWriter.GetIndexReader() method to create/refresh your searchers, while keeping the IndexWriter opened for as long as possible.
As a side note, MMapDirectory has always had bad performances compared to SimpleFSDirectory with Lucene.net, and I think its not even implemented in the 2.9.4.1 Version. I wouldnt recommend using it.