Class SegmentMerger


  • final class SegmentMerger
    extends java.lang.Object
    The SegmentMerger class combines two or more Segments, represented by an IndexReader, into a single Segment. Call the merge method to combine the segments.
    See Also:
    merge()
    • Method Detail

      • shouldMerge

        boolean shouldMerge()
        True if any merging should happen
      • merge

        MergeState merge()
                  throws java.io.IOException
        Merges the readers into the directory passed to the constructor
        Returns:
        The number of documents that were merged
        Throws:
        CorruptIndexException - if the index is corrupt
        java.io.IOException - if there is a low-level IO error
      • mergeDocValues

        private void mergeDocValues​(SegmentWriteState segmentWriteState)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • mergePoints

        private void mergePoints​(SegmentWriteState segmentWriteState)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • mergeNorms

        private void mergeNorms​(SegmentWriteState segmentWriteState)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • mergeFieldInfos

        public void mergeFieldInfos()
      • mergeFields

        private int mergeFields()
                         throws java.io.IOException
        Merge stored fields from each of the segments into the new one.
        Returns:
        The number of documents in all of the readers
        Throws:
        CorruptIndexException - if the index is corrupt
        java.io.IOException - if there is a low-level IO error
      • mergeVectors

        private int mergeVectors()
                          throws java.io.IOException
        Merge the TermVectors from each of the segments into the new one.
        Throws:
        java.io.IOException - if there is a low-level IO error
      • mergeTerms

        private void mergeTerms​(SegmentWriteState segmentWriteState,
                                NormsProducer norms)
                         throws java.io.IOException
        Throws:
        java.io.IOException