Greg Love wrote:
In the TheServerSide case study of the book, page 375, they say that they close the IndexWriter and even point out that they did before openning the IndexReader and deleting. So that kinda makes me wonder if i'm safe having an IndexReader with deletions and and IndexWriter with inserts open at the same time (even though my code never does an index modifying operation at the same time because they share a lock in the my code).
You should close the IndexReader you are using for deletions before opening the IndexWriter you use for additions. For higher throughput, queue additions and deletions and process them periodically as batches. If you're concerned about an addition followed by a deletion of the same document getting reversed in the queues, then simply check the addition queue each time you queue a deletion, and remove any matching additions.
Doug