java.lang.Object
org.apache.lucene.misc.index.IndexRearranger
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 ClassesModifier and TypeClassDescriptionprivate static class
static interface
Select document within a CodecReader -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IndexWriterConfig
protected final List
<IndexRearranger.DocumentSelector> protected final Directory
protected final Directory
-
Constructor Summary
ConstructorsConstructorDescriptionIndexRearranger
(Directory input, Directory output, IndexWriterConfig config, List<IndexRearranger.DocumentSelector> documentSelectors) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addOneSegment
(IndexWriter writer, IndexReader reader, IndexRearranger.DocumentSelector selector) void
execute()
-
Field Details
-
input
-
output
-
config
-
documentSelectors
-
-
Constructor Details
-
IndexRearranger
public IndexRearranger(Directory input, Directory output, IndexWriterConfig config, 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 Details
-
execute
- Throws:
Exception
-
addOneSegment
private static void addOneSegment(IndexWriter writer, IndexReader reader, IndexRearranger.DocumentSelector selector) throws IOException - Throws:
IOException
-