org.apache.lucene.index.pruning
Class StorePruningPolicy

java.lang.Object
  extended by org.apache.lucene.index.pruning.PruningPolicy
      extended by org.apache.lucene.index.pruning.StorePruningPolicy

public class StorePruningPolicy
extends PruningPolicy

Pruning policy for removing stored fields from documents.


Field Summary
protected  Set<String> deleteAll
          Fields to be completely deleted
protected  int delFields
           
protected  Map<String,Integer> fieldFlags
          Pruning in effect for each field
protected  org.apache.lucene.index.pruning.StorePruningPolicy.DelFieldSelector fs
           
protected  IndexReader in
           
 
Fields inherited from class org.apache.lucene.index.pruning.PruningPolicy
DEL_ALL, DEL_PAYLOADS, DEL_POSTINGS, DEL_STORED, DEL_VECTOR
 
Constructor Summary
StorePruningPolicy(IndexReader in, Map<String,Integer> fieldFlags)
          Constructs a policy.
 
Method Summary
 FieldInfos getFieldInfos(FieldInfos allInfos)
          Compute field infos that should be retained
 Document pruneDocument(int doc, FieldSelector parent)
          Prune stored fields of a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldFlags

protected Map<String,Integer> fieldFlags
Pruning in effect for each field


deleteAll

protected Set<String> deleteAll
Fields to be completely deleted


fs

protected org.apache.lucene.index.pruning.StorePruningPolicy.DelFieldSelector fs

in

protected IndexReader in

delFields

protected int delFields
Constructor Detail

StorePruningPolicy

public StorePruningPolicy(IndexReader in,
                          Map<String,Integer> fieldFlags)
Constructs a policy.

Parameters:
in - input reader.
fieldFlags - a map where keys are field names, and flags are bitwise-OR values of flags defined in PruningPolicy.
Method Detail

getFieldInfos

public FieldInfos getFieldInfos(FieldInfos allInfos)
Compute field infos that should be retained

Parameters:
allInfos - original field infos
Returns:
those of the original field infos which should not be removed.

pruneDocument

public Document pruneDocument(int doc,
                              FieldSelector parent)
                       throws IOException
Prune stored fields of a document. Note that you can also arbitrarily change values of the retrieved fields, so long as the field names belong to a list of fields returned from getFieldInfos(FieldInfos).

Parameters:
doc - document number
parent - original field selector that limits what fields will be retrieved.
Returns:
a pruned instance of a Document.
Throws:
IOException