add implementation of Database.indexDocument