There are several parts to the answer of the question. First of all, there is no guarantee whether you get a same IndexReader. Each time you call ReaderProvider#openIndexReader, IndexReader#reopen() is called under the hood, depending on whether or not the index has changed. So there is no guarantee there.
Now to the transactions. Here a lot will depend on the isolation level and whether you are using transactional batching (which is the default). In this case all Lucene work is batched and executed as a transaction synchronization. So the question is whether in your setup it is possible for an update/delete transaction to complete while another read transaction is in progress. In the default isolation level of READ COMMITTED this can in fact happen, so there is no guarantee here. You could change the isolation level, but that might have other implications and should be carefully thought through.
Is there a particular use-case you have in mind?
--Hardy
|