org.apache.lucene.misc.index

## Class IndexRearranger

- java.lang.Object
- - org.apache.lucene.misc.index.IndexRearranger

-     public class IndexRearranger
      extends Object

  Copy and rearrange index according to document selectors, from input dir to output dir. Length of documentSelectors determines how many segments there will be

  TODO: another possible (faster) approach to do this is to manipulate FlushPolicy and MergePolicy at indexing time to create small desired segments first and merge them accordingly for details please see: https://markmail.org/message/lbtdntclpnocmfuf

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `IndexRearranger.DocumentSelector` Select document within a CodecReader

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IndexWriterConfig` | `config`
    `protected List<IndexRearranger.DocumentSelector>` | `documentSelectors`
    `protected Directory` | `input`
    `protected Directory` | `output`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexRearranger(Directory input, Directory output, IndexWriterConfig config, List<IndexRearranger.DocumentSelector> documentSelectors)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### input

          protected final Directory input

    - #### output

          protected final Directory output

    - #### config

          protected final IndexWriterConfig config

    - #### documentSelectors

          protected final List<IndexRearranger.DocumentSelector> documentSelectors

  - ### Constructor Detail

    - #### IndexRearranger

          public IndexRearranger(Directory input,
                                 Directory output,
                                 IndexWriterConfig config,
                                 List<IndexRearranger.DocumentSelector> documentSelectors)

  - ### Method Detail

    - #### execute

          public void execute()
                       throws Exception

      Throws:
        `Exception`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.