private DocIdSetIterator iterateAllDocs() { IndexReader reader = searcher.getIndexReader(); final Bits liveDocs = MultiFields.getLiveDocs( reader ); final DocIdSetIterator allDocs = DocIdSetIterator.all( reader.maxDoc() ); if ( liveDocs == null ) { return allDocs; } return new FilteredDocIdSetIterator( allDocs ) { @Override protected boolean match( int doc ) { return liveDocs.get( doc ); } }; }