: > not really ... adding a document multiple times is a perfectly legal use : > case, adding a document with a "Reader" based field where the reader is : > already closed ... that's not legal (And Lucene doesn't really have any : > way of knowing if the Reader is closed because *it* closed it.
: Now I am confused, I must be missing something fundamental. I take no : action that I am aware of which closes the Reader, so how is it : happening? The attached code demonstrates the exception - please can : you advise on what is happening under the covers? :-) sorry for confusing you ... i should have said there are *some* use cases where adding the same document twice is legal -- but documents contain Fields that specify a reader are not one of those cases -- IndexWriter consumes and closes the Reader to get the tokens for indexing, and the next time you re-add that same Document, the Reader is already closed. My point was in response to your question about why IndexWRiter doesn't give you a different error about duplicate documents: it can't because there are *other* cases where indexing the same doc over and over is fine (docs that just contain simple strings). All IndexWRiter kows when it sees a closed Reader is that it's closed, and it can't read from it -- it has no way of knowing *why* it's closed. (trying to keep track of ever Reader IndexWriter ever closed would be an intractable problem) -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org