Factored out DocumentIndex