// mark the document that reindexing is required
copy.add(new Field(FieldNames.REINDEXING_REQUIRED, "", Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
Iterator fields = doc.getFields().iterator();
while (fields.hasNext())
{
Fieldable f = (Fieldable)fields.next();
Fieldable field = null;
Field.TermVector tv = getTermVectorParameter(f);
Field.Store stored = getStoreParameter(f);
Field.Index indexed = getIndexParameter(f);
if (f instanceof LazyTextExtractorField || f.readerValue() != null)
{
// replace all readers with empty string reader
field = new Field(f.name(), new StringReader(""), tv);
}
else if (f.stringValue() != null)
{
field = new Field(f.name(), f.stringValue(), stored, indexed, tv);
}
else if (f.isBinary())
{
field = new Field(f.name(), f.binaryValue(), stored);
}
if (field != null)
{
field.setOmitNorms(f.getOmitNorms());
copy.add(field);
}
}
// schedule the original document for later indexing
Document existing = indexingQueue.addDocument(doc);