code: public void searchAllDocuments (@Nonnull final Query aQuery,
                                    @CheckForSigned final int nMaxResultCount,
                                    @Nonnull final Consumer <? super PDStoredBusinessEntity> aConsumer) throws IOException
    {
      ValueEnforcer.notNull (aQuery, "Query");
      ValueEnforcer.notNull (aConsumer, "Consumer");
  
      final ObjIntConsumer <Document> aConverter = (aDoc,
                                                    nDocID) -> aConsumer.accept (PDStoredBusinessEntity.create (aDoc));
      if (nMaxResultCount <= 0)
      {
        // Search all
        final Collector aCollector = new AllDocumentsCollector (m_aLucene, aConverter);
        searchAtomic (aQuery, aCollector);
      }
      else
      {
        // Search top docs only
        final TopScoreDocCollector aCollector = TopScoreDocCollector.create (nMaxResultCount, Integer.MAX_VALUE);
        searchAtomic (aQuery, aCollector);
        for (final ScoreDoc aScoreDoc : aCollector.topDocs ().scoreDocs)
        {
          final Document aDoc = m_aLucene.getDocument (aScoreDoc.doc);
          if (aDoc == null)
            throw new IllegalStateException ("Failed to resolve Lucene Document with ID " + aScoreDoc.doc);
          // Pass to Consumer
          aConsumer.accept (PDStoredBusinessEntity.create (aDoc));
        }
      }
    }
docs: Search all documents matching the passed query and pass the result on to
  the provided {@link Consumer}.
  
  @param aQuery
  Query to execute. May not be <code>null</code>-
  @param nMaxResultCount
  Maximum number of results. Values &le; 0 mean all.
  @param aConsumer
  The consumer of the {@link PDStoredBusinessEntity} objects.
  @throws IOException
  On Lucene error
  @see #searchAtomic(Query, Collector)
  @see #getAllDocuments(Query,int)