refactor doc indexer