## org.apache.lucene.index
Class PruningReader

    java.lang.Object
      org.apache.lucene.index.IndexReader
          org.apache.lucene.index.FilterIndexReader
              org.apache.lucene.index.PruningReader

All Implemented Interfaces:
  Closeable, Cloneable

    public class PruningReader

extends org.apache.lucene.index.FilterIndexReader

This class produces a subset of the input index, by removing some postings data according to rules implemented in a `TermPruningPolicy`, and optionally it can also remove stored fields of documents according to rules implemented in a `StorePruningPolicy`.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.index.FilterIndexReader
`org.apache.lucene.index.FilterIndexReader.FilterTermDocs, org.apache.lucene.index.FilterIndexReader.FilterTermEnum, org.apache.lucene.index.FilterIndexReader.FilterTermPositions`

Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
`org.apache.lucene.index.IndexReader.ReaderClosedListener`

Field Summary
`protected int` `delTermCount`
`protected int` `delVecCount`
`protected int` `docCount`
`protected int` `prunedVecCount`
`protected StorePruningPolicy` `storePolicy`
`protected int` `termCount`
`protected TermPruningPolicy` `termPolicy`
`protected int` `vecCount`

Fields inherited from class org.apache.lucene.index.FilterIndexReader
`in`

Fields inherited from class org.apache.lucene.index.IndexReader
`hasChanges`

Constructor Summary
`PruningReader(org.apache.lucene.index.IndexReader in, StorePruningPolicy storePolicy, TermPruningPolicy termPolicy)` Constructor.

Method Summary
`org.apache.lucene.document.Document` `document(int n, org.apache.lucene.document.FieldSelector fieldSelector)` Applies a `StorePruningPolicy` to stored fields of a document.
`org.apache.lucene.index.FieldInfos` `getFieldInfos()` Applies a `StorePruningPolicy` to the list of available field infos.
`org.apache.lucene.index.IndexReader[]` `getSequentialSubReaders()`
`org.apache.lucene.index.TermFreqVector[]` `getTermFreqVectors(int docNumber)` Applies `TermPruningPolicy` to terms inside term vectors.
`org.apache.lucene.index.TermPositions` `termPositions()` Applies `TermPruningPolicy` to term positions.
`org.apache.lucene.index.TermEnum` `terms()` Applies `TermPruningPolicy` to term enum.

Methods inherited from class org.apache.lucene.index.FilterIndexReader
`directory, docFreq, doClose, doCommit, doDelete, doSetNorm, doUndeleteAll, getCommitUserData, getCoreCacheKey, getDeletesCacheKey, getIndexCommit, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermInfosIndexDivisor, getUniqueTermCount, getVersion, hasDeletions, hasNorms, isCurrent, isDeleted, isOptimized, maxDoc, norms, norms, numDocs, termDocs, termDocs, terms, toString`

Methods inherited from class org.apache.lucene.index.IndexReader

`acquireWriteLock, addReaderClosedListener, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, document, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, ensureOpen, flush, flush, getCommitUserData, getCurrentVersion, getRefCount, incRef, indexExists, lastModified, listCommits, numDeletedDocs, open, open, open, open, open, open, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged, removeReaderClosedListener, reopen, reopen, reopen, reopen, setNorm, setNorm, termPositions, tryIncRef, undeleteAll`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### docCount

    protected int docCount

### vecCount

    protected int vecCount

### termCount

    protected int termCount

### delTermCount

    protected int delTermCount

### prunedVecCount

    protected int prunedVecCount

### delVecCount

    protected int delVecCount

### termPolicy

    protected TermPruningPolicy termPolicy

### storePolicy

    protected StorePruningPolicy storePolicy

Constructor Detail

### PruningReader

    public PruningReader(org.apache.lucene.index.IndexReader in,
                         StorePruningPolicy storePolicy,
                         TermPruningPolicy termPolicy)

  Constructor.

  Parameters:
    `in` - input reader
    `storePolicy` - implementation of `StorePruningPolicy` - if null then stored values will be retained as is.
    `termPolicy` - implementation of `TermPruningPolicy`, must not be null.

Method Detail

### getSequentialSubReaders

    public org.apache.lucene.index.IndexReader[] getSequentialSubReaders()

  Overrides:
    `getSequentialSubReaders` in class `org.apache.lucene.index.FilterIndexReader`

### document

    public org.apache.lucene.document.Document document(int n,
                                                        org.apache.lucene.document.FieldSelector fieldSelector)
                                                 throws org.apache.lucene.index.CorruptIndexException,
                                                        IOException

  Applies a `StorePruningPolicy` to stored fields of a document.

  Overrides:
    `document` in class `org.apache.lucene.index.FilterIndexReader`
  Throws:
    `org.apache.lucene.index.CorruptIndexException`
    `IOException`

### getFieldInfos

    public org.apache.lucene.index.FieldInfos getFieldInfos()

  Applies a `StorePruningPolicy` to the list of available field infos.

  Overrides:
    `getFieldInfos` in class `org.apache.lucene.index.FilterIndexReader`

### getTermFreqVectors

    public org.apache.lucene.index.TermFreqVector[] getTermFreqVectors(int docNumber)
                                                                throws IOException

  Applies `TermPruningPolicy` to terms inside term vectors.

  Overrides:
    `getTermFreqVectors` in class `org.apache.lucene.index.FilterIndexReader`
  Throws:
    `IOException`

### termPositions

    public org.apache.lucene.index.TermPositions termPositions()
                                                        throws IOException

  Applies `TermPruningPolicy` to term positions.

  Overrides:
    `termPositions` in class `org.apache.lucene.index.FilterIndexReader`
  Throws:
    `IOException`

### terms

    public org.apache.lucene.index.TermEnum terms()
                                           throws IOException

  Applies `TermPruningPolicy` to term enum.

  Overrides:
    `terms` in class `org.apache.lucene.index.FilterIndexReader`
  Throws:
    `IOException`