Class PerFieldMergeState

java.lang.Object
org.apache.lucene.codecs.perfield.PerFieldMergeState

final class PerFieldMergeState extends Object
Utility class to update the MergeState instance to be restricted to a set of fields.

Warning: the input MergeState instance will be updated when calling apply(Collection).

It should be called within a try {...} finally {...} block to make sure that the mergeState instance is restored to its original state:

 PerFieldMergeState pfMergeState = new PerFieldMergeState(mergeState);
 try {
   doSomething(pfMergeState.apply(fields));
   ...
 } finally {
   pfMergeState.reset();
 }
 
  • Field Details

    • in

      private final MergeState in
    • orgMergeFieldInfos

      private final FieldInfos orgMergeFieldInfos
    • orgFieldInfos

      private final FieldInfos[] orgFieldInfos
    • orgFieldsProducers

      private final FieldsProducer[] orgFieldsProducers
  • Constructor Details

    • PerFieldMergeState

      PerFieldMergeState(MergeState in)
  • Method Details

    • apply

      MergeState apply(Collection<String> fields)
      Update the input MergeState instance to restrict the fields to the given ones.
      Parameters:
      fields - The fields to keep in the updated instance.
      Returns:
      The updated instance.
    • reset

      MergeState reset()
      Resets the input MergeState instance to its original state.
      Returns:
      The reset instance.