Lucene gurus, I have a question regarding RAMDirectory usage. Can the IndexWriter keep adding documents to the index meanwhile the IndexReader is open on this RAMDirectory and searches going on?
I know in a FSDirectory case, the IndexWriter can add documents to the index meanwhile IndexReader reads from the index. This is because the IndexWriter just writes new index files rather than modifying existing index files. The only place (I remember) that the new and old indexes will conflict is the segment file. Again, once the IndexWriter commits the change (by calling close() method), the segment.new is renamed to segment atomically. Since the old segment file is cached in memory by the IndexReader, so not a problem for the IndexReader to serve search requests. The old segment file is cached in memory, the other files pointed to by the old segment file are cached by Linux anyway, or not removed by windows due to still being used. Anyway, back to the RAMDirectory case. Having an IndexReader open while IndexWriter adding documents to it, will that cause any issue? Thanks, Jian