use friend class to Document and IndexWriter.