Package org.apache.lucene.index.pruning
Class StorePruningPolicy
- java.lang.Object
-
- org.apache.lucene.index.pruning.PruningPolicy
-
- org.apache.lucene.index.pruning.StorePruningPolicy
-
public class StorePruningPolicy extends PruningPolicy
Pruning policy for removing stored fields from documents.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>
deleteAll
Fields to be completely deletedprotected int
delFields
protected Map<String,Integer>
fieldFlags
Pruning in effect for each fieldprotected org.apache.lucene.index.pruning.StorePruningPolicy.DelFieldSelector
fs
protected org.apache.lucene.index.IndexReader
in
-
Fields inherited from class org.apache.lucene.index.pruning.PruningPolicy
DEL_ALL, DEL_PAYLOADS, DEL_POSTINGS, DEL_STORED, DEL_VECTOR
-
-
Constructor Summary
Constructors Constructor Description StorePruningPolicy(org.apache.lucene.index.IndexReader in, Map<String,Integer> fieldFlags)
Constructs a policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.index.FieldInfos
getFieldInfos(org.apache.lucene.index.FieldInfos allInfos)
Compute field infos that should be retainedorg.apache.lucene.document.Document
pruneDocument(int doc, org.apache.lucene.document.FieldSelector parent)
Prune stored fields of a document.
-
-
-
Constructor Detail
-
StorePruningPolicy
public StorePruningPolicy(org.apache.lucene.index.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 inPruningPolicy
.
-
-
Method Detail
-
getFieldInfos
public org.apache.lucene.index.FieldInfos getFieldInfos(org.apache.lucene.index.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 org.apache.lucene.document.Document pruneDocument(int doc, org.apache.lucene.document.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 fromgetFieldInfos(FieldInfos)
.- Parameters:
doc
- document numberparent
- original field selector that limits what fields will be retrieved.- Returns:
- a pruned instance of a Document.
- Throws:
IOException
-
-