addIndexes
Adds all segments from an array of indexes into this index.
This may be used to parallelize batch indexing. A large document collection can be broken into sub-collections. Each sub-collection can be indexed in parallel, on a different thread, process or machine. The complete index can then be created by merging sub-collection indexes with this method.
NOTE: this method acquires the write lock in each directory, to ensure that no IndexWriter is currently open or tries to open while this is running.
This method is transactional in how Exceptions are handled: it does not commit a new segments_N file until all indexes are added. This means if an Exception occurs (for example disk full), then either no indexes will have been added or they all will have been.
Note that this requires temporary free space in the Directory up to 2X the sum of all input indexes (including the starting index). If readers/searchers are open against the starting index, then temporary free space required will be higher by the size of the starting index (see .forceMerge for details).
This requires this index not be among those to be added.
All added indexes must have been created by the same Lucene version as this index.
Return
The #sequence_number for this operation
Throws
if the index is corrupt
if there is a low-level IO error
if addIndexes would cause the index to exceed .MAX_DOCS, or if the incoming index sort does not match this index's index sort
Merges the provided indexes into this index.
The provided IndexReaders are not closed.
See .addIndexes for details on transactional semantics, temporary free space required in the Directory, and non-CFS segments on an Exception.
NOTE: empty segments are dropped by this method and not added to this index.
NOTE: provided LeafReaders are merged as specified by the API. Default behavior is to merge all provided readers into a single segment. You can modify this by overriding the findMerge API in your custom merge policy.
Return
The #sequence_number for this operation
Throws
if the index is corrupt
if there is a low-level IO error
if addIndexes would cause the index to exceed .MAX_DOCS