Hi Neil, the issue here is a API problem still present in Lucene 4.x. In Lucene 5 you cannot do that anymore (reindex a document by passing IndexReader's return value into IndexWriter), so we will not fix the issue for 4.x. In 5.0 the world looks like that and then it's no longer a problem (because you cannot do what you want to do without an extra step):
- In Lucene 5, IndexReader.document() will return StoredDocument - StoredDocument is incompatible to IndexedDocument, so you cannot pass StoredDocument to IndexWriter. In Lucene 5 you have to copy the fields to a new index document and then you have to take care to set properties correctly. The information if a field was indexed or not is not available to IndexReader, so it cannot fill that information. So the API glitch in previous Lucene versions and also 4.x is the fact that a stored document does not differ API-wise from an indexer document. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Neil Ireson [mailto:n.ire...@dcs.shef.ac.uk] > Sent: Friday, April 26, 2013 3:43 PM > To: java-user@lucene.apache.org > Subject: Re: Indexed numeric fields return indexed() == false > > Thanks for the reply. > > I don't understand why I cannot "read an existing document,... and add it to > an existing or new index". > > I understand this wouldn't work for fields which are not stored, I also > understand that I am responsible for making sure the tokenizers and > analyzers are the same, but given these caveats, what is the reason for it > failing to work for all stored fields. > > As I said before the process works fine for StringField types and as far as I > can > see the only reason it fails for DoubleField types is that the > fieldType().indexed() incorrectly returns false when it is indexed. > > N > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org