I want a list of all the (path of the) documents contained in a given Lucene 4 index.
According to this, (see item Lucene-2600) the code to use is
import org.apache.lucene.util.Bits;
import org.apache.lucene.index.MultiFields;
Bits liveDocs = MultiFields.getLiveDocs(indexReader);
if (!liveDocs.get(docID)) {
// document is deleted...
}
But, the getLiveDocs documentation states liveDocs
can be null.
What happens in that case? Is there really no easy way to list the documents in a index?