Indexing a document