Hello! I was examining the Lucene source code with the desire to figure out how an IndexSearcher could be safely used while IndexWriter is open on the same directory. My concern is that when an IndexWriter is open, it could remove existing files in the directory (for example: during the merge procedure), meanwhile these files are being used by IndexSearcher. I'm asking because I want to implement my own directory and I'm not sure if it's safe to keep an IndexWriter open while I'm using IndexSearch to execute search queries. I see that once an IndexSearcher is open, it opens several segments files and keeps them open.
Is it safe to use IndexWriter and IdnexSearcher at the same time? And if so, how does IndexWriter not break the active IndexSearcher? Thank you.