Package org.apache.lucene.misc.index
Class IndexRearranger
- java.lang.Object
-
- org.apache.lucene.misc.index.IndexRearranger
-
public class IndexRearranger extends java.lang.ObjectCopy and rearrange index according to document selectors, from input dir to output dir. Length of documentSelectors determines how many segments there will beTODO: 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 Description private static classIndexRearranger.DocSelectorFilteredCodecReaderstatic interfaceIndexRearranger.DocumentSelectorSelect document within a CodecReader
-
Field Summary
Fields Modifier and Type Field Description protected IndexWriterConfigconfigprotected java.util.List<IndexRearranger.DocumentSelector>documentSelectorsprotected Directoryinputprotected Directoryoutput
-
Constructor Summary
Constructors Constructor Description IndexRearranger(Directory input, Directory output, IndexWriterConfig config, java.util.List<IndexRearranger.DocumentSelector> documentSelectors)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidaddOneSegment(IndexWriter writer, IndexReader reader, IndexRearranger.DocumentSelector selector)voidexecute()
-
-
-
Field Detail
-
input
protected final Directory input
-
output
protected final Directory output
-
config
protected final IndexWriterConfig config
-
documentSelectors
protected final java.util.List<IndexRearranger.DocumentSelector> documentSelectors
-
-
Constructor Detail
-
IndexRearranger
public IndexRearranger(Directory input, Directory output, IndexWriterConfig config, java.util.List<IndexRearranger.DocumentSelector> documentSelectors)
Constructor- Parameters:
input- input diroutput- output dirconfig- index writer configdocumentSelectors- specify what document is desired in the rearranged index segments, each selector correspond to one segment
-
-
Method Detail
-
execute
public void execute() throws java.lang.Exception- Throws:
java.lang.Exception
-
addOneSegment
private static void addOneSegment(IndexWriter writer, IndexReader reader, IndexRearranger.DocumentSelector selector) throws java.io.IOException
- Throws:
java.io.IOException
-
-