lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bamford <Chris.Bamf...@scalix.com>
Subject RE: New "Stream closed" exception with Java 6 - solved
Date Mon, 21 Sep 2009 09:05:49 GMT
Understood.  Thanks Hoss.

- Chris


----- Original Message -----
From: Chris Hostetter <hossman_lucene@fucit.org>
Sent: Fri, 18/9/2009 5:58pm
To: java-user@lucene.apache.org
Subject: RE: New "Stream closed" exception with Java 6 - solved


: > 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message